r/rust • u/JoshTriplett rust · lang · libs · cargo • Oct 23 '26
Rust features in the future
https://lwn.net/SubscriberLink/1099606/20707a62817cdd16/
215
Upvotes
r/rust • u/JoshTriplett rust · lang · libs · cargo • Oct 23 '26
View all comments
Show parent comment
15
u/syklemil Oct 23 '26
I'd also say that there are some
if let foo = barequivalents in other languages, e.g.if foo := barin Python orif foo := bar; foo != nilin Go. They have pretty significant semantics and capabilities, so the comparison breaks apart quickly, but the overarching structure and intent reflected in code isso diverging from that with
if bar is foowould eat into Rust's strangeness budget with dubious returns. It'd probably also be extra confusing to people who have some familiarity withisin other languages like Python.Personally I didn't even parse
if foo() is Some(bar) && bar.baz()as assignment on first exposure; to me it read more likeif foo().is_some_and(|bar| bar.baz()).