-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
shadow_unrelated
's behaviour with closures (#13677)
Fixes #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 linebender/xilem#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
- Loading branch information
Showing
3 changed files
with
89 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters