blocks_in_if_conditions
triggers in while
loops in a too strigent way
#7580
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Lint name:
blocks_in_if_conditions
I tried this code:
https://github.com/ComunidadAylas/PackSquash/blob/b514fba469b38edf207120aaa3fb8a12476b72fe/src/squash_zip.rs#L277-L281
I expected to see this happen: no warnings emitted by Clippy.
Instead, this happened: Clippy emitted the warning. In my humble opinion, I think this warning is a false positive due to the following reasons:
if
condition, and the side effects of evaluating that expression are needed for the code to work as intended.while
loop and before finishing its body is not much better either, because it leads to duplicated code..await
, putting the offending code in a closure requires async closures, which is an unstable feature, and it might not be desirable to use additional unstable features because of this lint.Meta
cargo clippy -V
: clippy 0.1.56 (0035d9d 2021-08-16)rustc -Vv
:This warning did not occur in previous nightly versions of Clippy. I couldn't find any recent commit or issue that referenced this lint and may be the cause of it, either.
The text was updated successfully, but these errors were encountered: