One Hundred Rust PRs later

4 min read

It’s hard for me to believe but it’s already been over a year since I seriously committed to learning Rust and I have now reached my initial goal of 100 open source contributions to the Rust ecosystem. You can see the full list here.

103 / 100

I want to use this blog post to review the work I’ve done, talk about the challenges I’ve come across and how I’ve tried to deal with them. I’m afraid I haven’t blogged in a long time and this is a bit longer than usual.


I decided to work on Clippy for a couple of reasons:

I had done some small documentation contributions and was watching other people contribute new lints and such. With the beginning of 2018 I decided to focus on Rust in my free time as much as possible. It was also a sort of experiment on whether I had the grit to stay with a longer-term project.

January to March

At the beginning of January 2018, my first big Clippy contribution was a Lint that detects empty lines after outer attributes, such as:


fn something_to_document() { ... }
fn more_to_document() { ... }

The rationale for this lint is that the attribute was probably meant to be an inner attribute because it has empty lines that follow. In the process of writing that lint I learned that there are a lot of things to consider when linting Rust code and the lint resulted in a few false-positives that I also fixed.

I think this experience made me aware of how much potential for improvements there is in Clippy and I decided to spend more time on bug fixing than adding new lints from then on.

April to June

To prevent Clippy crashing on essential ecosystem crates, I added an integration test suite to Clippy that makes sure Clippy doesn’t crash when it’s executed on them.

In May I expanded the existing build script to include a check that ensures a recent nightly release is used to build Clippy. As of now, this has been removed again because Clippy is now distributed via Rustup.

July to November

From August to November 2018 I rewrote a 300 line python script in Rust to make it work cross-platform: #2985, #3320, #3325, #3327, #3388, #3399, #3408.
If you’ve contributed a Clippy lint before, chances are that you’ve used one of these versions. The rewrite is probably worth its own blog post at some point.

December to February 2019

In December I added Rustfix support to the compiletest-rs library, which in turn allows Clippy to test its code suggestions. This will prevent suggestion regressions, improve future suggestions and help pave the path to a reliable Clippy ⟺ Rustfix integration. This is an ongoing effort and if you want to help out with this, there is an open tracking issue with some instructions.

In January 2019 I added a lint that detects whether a function can be const or not. This lint is currently in the nursery group as the const_fn feature is not fully stabilized yet. You can give it a try by using #![warn(clippy::missing_const_for_fn)] if you are on beta or nightly.

Other contributions

Did it work?

I specifically started this project to improve my grit for longer-term projects and I would say that it worked. Together with other things, working on Clippy helped me to increase my focus to stick through harder tasks.

Working on crashes where I know next to nothing in the beginning is really hard motivation wise. In one case it has caused me to step away for a couple of weeks. This is something that I want to still work on.

I also want to solidify more fundamentals. When I go to the Rust Berlin learners meetup I sometimes feel like I can’t explain some things properly. I suppose one problem of fixing bugs in Clippy is that there’s not a lot of general Rust knowledge to learn. It’s more about very specific rustc or Clippy internals.

What’s next?

For the reasons mentioned at the beginning, I will absolutely continue working on Clippy and focus on improving its reliability. I am currently reworking the contribution guidelines to lower the bar of entry for new contributors and then want to get back to fixing bugs and crashes.

However, I also want to improve my fundamentals. To do that, I’m expanding my Anki card collection to be able to recall more from memory and going through TRPL a second time.

On to the next hundred contributions!

18 Feb 2019