Closed
Description
Lint name:
manual_flatten
I tried this code:
for server in self.servers.iter_mut() {
if let Some(server_inner) = server {
if server_inner.pid == target_pid {
*server = None;
}
}
}
I expected to see this happen: The lint should not have been emitted. Alternately, the suggestion should have resulted in code that compiled.
Instead, this happened: The Quick fix
resulted in code that did not compile.
Meta
cargo clippy -V
: clippy 0.1.54 (a178d032 2021-07-26)rustc -Vv
:rustc 1.54.0 (a178d0322 2021-07-26) binary: rustc commit-hash: a178d0322ce20e33eac124758e837cbd80a6f633 commit-date: 2021-07-26 host: x86_64-pc-windows-msvc release: 1.54.0 LLVM version: 12.0.1
Activity
dswij commentedon Aug 9, 2021
Depending on what
servers
is, this might be related to #7514.@xobs can you help clarify what
servers
is, or better provide a minimal example that we can run/test on?xobs commentedon Aug 9, 2021
Sure, here's a minimal example:
Here's a link to the Playground, which also gives this recommendation: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=265c9480c7cbb542e9dd26aca6562c2b
manual_flatten
#7566dswij commentedon Aug 14, 2021
Thanks for the minimal example!
This seems to be similar to #6784, I think we can close one in favor of the other.
Auto merge of #7566 - dswij:manual-flatten-use, r=xFrednet