Ramblings of an aging IT geek
← Ramblings of an aging IT geek
rust

the small joys of the 2018 edition

A few weeks into the Rust 2018 edition, the changes that actually altered how I write code day to day.

Editor open on Rust source

The 2018 edition landed in December with 1.31, and I've now had a few weeks of writing real code on it rather than just reading the announcement. The headline features got plenty of attention. What's surprised me is how much the small, boring stuff has changed my day.

The path changes are the big one. extern crate is gone from the top of every file, which sounds trivial until you realise how much ceremony it removed. Module paths now start from the crate root or crate::, and I no longer spend ten seconds working out why an import resolves in one file and not another. use crate::foo::Bar says exactly what it means.

Non-lexical lifetimes are the change I didn't know I was waiting for. Code the borrow checker used to reject for no reason a human could see now just compiles, because the borrow ends where you stopped using the value rather than at the end of the block. I've deleted a fair number of pointless intermediate let bindings that only existed to placate the old checker.

And ? works in more places, impl Trait is stable in argument and return position, and async is reserved for what's coming. None of this is revolutionary on its own. Together it's the difference between fighting the language and writing in it. Same compiler, same guarantees, far less friction. Good work, all of it.