News for hackers. Stuff that matters.
Re:Rust 1.50 by momothereal on Thursday February 11, 2021 @12:24PM (#26104361)
IMO it depends if you're already in a chaining context. I wouldn't use it in a simple if-else branch, but it also removes the need to use if-else when you're already in a 10-function long chain.

Before:

if a.b().c().d().e().f() { Some(g().h().i()) } else { None }

Now:

a().b().c().d().e().f().then(|| g().h().i())

Even better if you have multiple boolean returns in the chain.

There are no comments on this comment yet.