Yesterday, the Rust team announced the release of Rust 1.35.0. This release highlights the implementation of Fn* closure traits for Box
Key features explained in brief:
Fn* closure traits implemented for Box
In Rust 1.35.0, the FnOnce, FnMut, and the Fn traits are now implemented for Box
Coercing closures to unsafe function pointers
In the earlier versions, it was possible to coerce closures which do not capture from the environment, into function pointers only . With this release, coercing closures has been extended to ‘unsafe’ function pointers also.
Calling dbg!() with no argument
‘dbg!()’ macro allows to quickly inspect the value of some expression with context. Now, users can call dbg!() without passing any arguments. This is useful in tracing what branch your application will take.
In 1.35.0, a number of APIs have become stable. Few new implementations and other changes have also been made. Some are mentioned below:
- Copy the sign of a floating point number onto another
- Check whether a Range contains a value
- Map and split a borrowed RefCell value in two
- Replace the value of a RefCell through a closure
- Hash a pointer or reference by address, not value
- Copy the contents of an Option
To know more about the changes in Library, head over to the release notes page.
Changes in Clippy
Clippy is a collection of lints to catch common mistakes and improve the Rust code. In this release of Rust, a new lint ‘drop_bounds’ has been added. Also Clippy has split the lintredundant_closure into redundant_closure and redundant_closure_for_method_calls.
Changes in Cargo
- When passing a test filter, such as ‘cargo test foo’, the user does not have to build examples (unless they set test = true).
- ‘rustc-cdylib-link-arg’ key has been added to build scripts to specify linker arguments for cdylib crates.
- ‘Cargo clippy-preview’ is now a built-in cargo command.
- The verification step in ‘cargo package’ that checks if any files are modified is now stricter. It uses a hash of the contents instead of checking file system mtimes. It also checks all files in the package.
To know more about the changes in Cargo, head over to the release notes page.
Read more about the Rust 1.35.0 announcement on the official Rust blog.