about summary refs log tree commit diff
path: root/tests/rustdoc-ui/coverage/doc-examples.rs
diff options
context:
space:
mode:
authorJason Newcomb <jsnewcomb@pm.me>2024-11-30 17:08:08 +0000
committerGitHub <noreply@github.com>2024-11-30 17:08:08 +0000
commit650e0c8d3deeffc38cb7ca3f1eb4c7ac42b46d48 (patch)
treec66c06301cf2640567ccc198a47cbc43b70adf0e /tests/rustdoc-ui/coverage/doc-examples.rs
parentaf1f78af05af5ff7dd2d8b31386f96ce9bfc7a8a (diff)
parentd1cab0860a3b8d28f84a96661a1c6177a5e3fbba (diff)
downloadrust-650e0c8d3deeffc38cb7ca3f1eb4c7ac42b46d48.tar.gz
rust-650e0c8d3deeffc38cb7ca3f1eb4c7ac42b46d48.zip
Fix `shadow_unrelated`'s behaviour with closures (#13677)
Fixes https://github.com/rust-lang/rust-clippy/issues/10780

We correctly no longer give a warning when a closure is passed to a
method, where one of the arguments to that method uses the variable
which would be shadowed by an argument to that closure.
Uses is defined loosely as any expression used in the calling expression
mentions the shadowee binding (except for the closure itself):

```rust
#![deny(clippy::shadow_unrelated)]
let x = Some(1);
let y = x.map(|x| x + 1);
```
will now succeed.

See https://github.com/linebender/xilem/pull/745 - without this change,
all of the `expect(shadow_unrelated)` in the repository are met; with
it, none of them are.

changelog: [`shadow_unrelated`]: Don't treat closures arguments as
unrelated when the calling function uses them
Diffstat (limited to 'tests/rustdoc-ui/coverage/doc-examples.rs')
0 files changed, 0 insertions, 0 deletions