2 ms·
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 al
by momothereal 6y ago
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.