-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a match statement for builtin detection (#5798)
## Summary We've seen speed-ups in the past by converting from slice iteration to match statements; this just does the same for built-in checks.
- Loading branch information
1 parent
01b05fe
commit d692ed0
Showing
3 changed files
with
174 additions
and
5 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,5 +1,5 @@ | ||
use ruff_python_stdlib::builtins::BUILTINS; | ||
use ruff_python_stdlib::builtins::is_builtin; | ||
|
||
pub(super) fn shadows_builtin(name: &str, ignorelist: &[String]) -> bool { | ||
BUILTINS.contains(&name) && ignorelist.iter().all(|ignore| ignore != name) | ||
is_builtin(name) && ignorelist.iter().all(|ignore| ignore != name) | ||
} |
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