Pretty day for making things right: Rust 1.55 adds open range patterns, improves float parsing

Rust Foundation

Programming language Rust 1.55 is ready to be downloaded. Alongside 17 stabilised methods and trait implementations, the sixth feature release of the year includes two new language features meant to simplify Rust usage.

Starting with the new version, developers officially get to use open ranges (X..) in patterns, something that can be useful for matching purposes for example. FromRange patterns begin at X and end at the maximum value of an integer so that users have to repeat fewer things in their statements and produce code that is easier to refactor, according to the Rust team. Another change lets developers explicitly import preludes to different editions of the language via std::prelude.

Since there were some problems with the standard library’s handling of floating point values, the Rust team used the opportunity to update the std library with a new implementation of float parsing. It now uses the Eisel-Lemire algorithm, which is meant to improve the speed and correctness of the parsing process, but should also help to have the library no longer reject things like large denormalised floats which are valid but couldn’t be processed before.

Another change the Rust team highlighted in its blog concerns the std::io::ErrorKind variants. In Rust 1.55, standard functions that return an io::Error will no longer use the ErrorKind::Other variant but rather the internal ErrorKind::Uncategorized. This is supposed to make it more clear that they don’t represent a user error and make room for the introduction of more specific error variants in the next couple of releases.

As part of the Rust release, package manager Cargo also got an update which adds a method to mutably access the members of a workspace, contains cargo d as a shorthand for cargo doc, and exposes default_run information in cargo metadata. To make the tool’s output a little easier to read, Cargo 1.55 promises to no longer show duplicate compiler diagnostics, and provide more context as well as a cleaner form when displaying warnings or errors. 

Cargo will now also put out error notices when users specify a dependency without any keys or use git keys on non-git dependencies, and show registry names instead of URLs where it’s an option. Under the hood libcurl has been updated to version 7.78, since its predecessor apparently caused some problems on machines running on older versions of Windows.

For Rust’s lint collection Clippy, the developers decided to mark the --fix option that automatically applies Clippy suggestions as stable and added a new suspicious lint group for everything used to find “most likely wrong or useless” code. They went on to include new lints to check for Rc<Mutex<T>>, consistent bracing when using common macros, self-named constructors, undesirable types, bad use of extend, and missing import renames. Details on those and a couple of corrected false positives and enhancements can be found in Rust Clippy’s release notes.