clippy blocks_in_conditions - suppress globally?
Current nightly produces a lot of these:
warning: in a `match` scrutinee, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let`
--> crates/tor-hsservice/src/svc/ipt_establish.rs:669:72
|
669 | match self.establish_intro_once().await.and_then(|session| {
| ________________________________________________________________________^
670 | | let netdir = self
671 | | .netdir_provider
672 | | .timely_netdir()
... |
677 | | Ok((session, GoodIptDetails::try_from_circ_target(&relay)?))
678 | | }) {
| |_____________^
This trips on what is a very common pattern in our codebase:
match thing.do()
.complicated(|| ...)
....
{
OK...) => ...
(likewise with IEFEs).
I don't agree with these warnings. I think this is a fine pattern, and adding an intermediate binding (which would often have a generic name like ret
or outcome
) would make the code less clear.
In my clippy fixes MR, I'm going to add suppressions at each site. But, I think we should add this to our global list of lint suppressions.