Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore annotated lambdas in class scopes (#10720)
## Summary An annotated lambda assignment within a class scope is often intentional. For example, within a dataclass or Pydantic model, these are treated as fields rather than methods (and so can be passed values in constructors). I originally wrote this to special-case dataclasses and Pydantic models... But was left feeling like we'd see more false positives here for little gain (an annotated lambda within a `class` is likely intentional?). Open to opinions, though. Closes #10718.
- Loading branch information
1 parent
67f0f61
commit d36f609
Showing
4 changed files
with
29 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/// Returns `true` if the name should be considered "ambiguous". | ||
pub(super) fn is_ambiguous_name(name: &str) -> bool { | ||
name == "l" || name == "I" || name == "O" | ||
} |
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