mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 04:19:18 +00:00
[ruff
] Detect unnecessary dict
comprehensions for iterables (RUF025
) (#9613)
## Summary Checks for unnecessary `dict` comprehension when creating a new dictionary from iterable. Suggest to replace with `dict.fromkeys(iterable)` See: https://github.com/astral-sh/ruff/issues/9592 ## Test Plan ```bash cargo test ```
This commit is contained in:
parent
395bf3dc98
commit
eab1a6862b
10 changed files with 488 additions and 3 deletions
|
@ -928,6 +928,7 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
|
|||
(Ruff, "022") => (RuleGroup::Preview, rules::ruff::rules::UnsortedDunderAll),
|
||||
(Ruff, "023") => (RuleGroup::Preview, rules::ruff::rules::UnsortedDunderSlots),
|
||||
(Ruff, "024") => (RuleGroup::Preview, rules::ruff::rules::MutableFromkeysValue),
|
||||
(Ruff, "025") => (RuleGroup::Preview, rules::ruff::rules::UnnecessaryDictComprehensionForIterable),
|
||||
(Ruff, "100") => (RuleGroup::Stable, rules::ruff::rules::UnusedNOQA),
|
||||
(Ruff, "200") => (RuleGroup::Stable, rules::ruff::rules::InvalidPyprojectToml),
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue