mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-27 15:03:51 +00:00
Rewrite a variety of .contains()
calls as matches!
statements (#5432)
## Summary These have the potential to be much more efficient, as we've seen in the past.
This commit is contained in:
parent
aa887d5a1d
commit
a973019358
10 changed files with 183 additions and 169 deletions
|
@ -1,13 +1,17 @@
|
|||
/// A copy of `__future__.all_feature_names`.
|
||||
pub const ALL_FEATURE_NAMES: &[&str] = &[
|
||||
"nested_scopes",
|
||||
"generators",
|
||||
"division",
|
||||
"absolute_import",
|
||||
"with_statement",
|
||||
"print_function",
|
||||
"unicode_literals",
|
||||
"barry_as_FLUFL",
|
||||
"generator_stop",
|
||||
"annotations",
|
||||
];
|
||||
/// Returns `true` if `name` is a valid `__future__` feature name, as defined by
|
||||
/// `__future__.all_feature_names`.
|
||||
pub fn is_feature_name(name: &str) -> bool {
|
||||
matches!(
|
||||
name,
|
||||
"nested_scopes"
|
||||
| "generators"
|
||||
| "division"
|
||||
| "absolute_import"
|
||||
| "with_statement"
|
||||
| "print_function"
|
||||
| "unicode_literals"
|
||||
| "barry_as_FLUFL"
|
||||
| "generator_stop"
|
||||
| "annotations"
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue