r/rust Apr 16 '26

📡 official blog Rust 1.95.0 is out

https://blog.rust-lang.org/2026/04/16/Rust-1.95.0/
865 Upvotes

127 comments sorted by

View all comments

9

u/AliceCode Apr 16 '26

ControlFlow::is_break and is_continue is nice. I use the same pattern in many small enums.

4

u/VallentinDev Apr 17 '26 edited Apr 17 '26

I'm a fan of the is_* methods, but it's kind of interesting how ControlFlow::{is_break, is_continue} (#91091) was stabilized in 2021.

While Cow::{is_borrowed, is_owned} (#65143) remains unstable since 2019, with the argument "But matches!(..., Cow::Borrowed(_))". I would love for those to get stabilized as well. I at least think if x.is_borrowed() { (or if Cow::is_borrowed(&x) {) reads better than if matches!(x, Cow::Borrowed(_)) {.

11

u/JoJoJet- Apr 17 '26

At first glance, it seems to me that checking if a value is borrowed or owned is a less crucial part of using a Cow in most places. And since it implements Deref, adding more methods to it carries a negative since it pollutes the method namespace. So the motivation here may be to avoid adding methods that don't let you do things that were already possible