🇮🇹

Rust 1.95 Ships with Built-in Platform Selection and Enhanced Match Syntax

Rust 1.95.0 ships with cfg_select!, a built-in macro that eliminates the need for a widely-used external crate, while match expressions gain more flexibility through if-let guard support.

No login, no IP stored.

Rust 1.95.0 arrived yesterday via rustup update stable. Two features stand out for everyday Rust development, plus one change worth noting if you work on non-standard platforms.

Fewer External Dependencies for Platform-Specific Code

The new cfg_select! macro lets you choose different code blocks based on target platform or compilation flags, using syntax similar to a regular match statement. Until now, the go-to solution was the cfg-if crate, widely used across projects. With Rust 1.95, this functionality moves into the standard library, eliminating the external dependency.

If-Let Guards in Match Expressions

Rust 1.88 introduced let chains, allowing you to chain multiple let conditions in a single if or while expression. Rust 1.95 extends this to match statements: you can now add an if let condition directly on a match arm, combining pattern matching and a secondary value check in one go. For anyone working with complex data structures or optional results, this means cleaner code without splitting logic across multiple steps.

Note for Embedded Developers

Rust 1.95 removes support for JSON-based custom target specifications from the stable release. These are mainly used in embedded development for unofficially supported platforms. As the Rust team explains, this feature already required the nightly channel, so stable-only users shouldn’t notice anything. The team opened an issue to gather real-world use cases before deciding whether and how to stabilize something down the road.

Support Yoota · affiliate link

Spread the word

Sniff out what’s new (follow me 🐾)

YOOTA
YOOTA
@en@yoota.it

Sniffing out tech news

480 posts
8 followers

Continua a fiutare

Loading top paws…

Cookies! We don't use tracking cookies or collect personal data, but since this site is federated via ActivityPub ⁂, your visit may connect to Mastodon or other federated servers.Affiliations: Some articles include affiliate links. When you buy through them, we may earn a small commission.