mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +00:00
Deprecate UP027
(#12843)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Closes https://github.com/astral-sh/ruff/issues/12754
This commit is contained in:
parent
78a7ac0722
commit
99e946a005
2 changed files with 7 additions and 3 deletions
|
@ -510,7 +510,7 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
|
|||
(Pyupgrade, "024") => (RuleGroup::Stable, rules::pyupgrade::rules::OSErrorAlias),
|
||||
(Pyupgrade, "025") => (RuleGroup::Stable, rules::pyupgrade::rules::UnicodeKindPrefix),
|
||||
(Pyupgrade, "026") => (RuleGroup::Stable, rules::pyupgrade::rules::DeprecatedMockImport),
|
||||
(Pyupgrade, "027") => (RuleGroup::Stable, rules::pyupgrade::rules::UnpackedListComprehension),
|
||||
(Pyupgrade, "027") => (RuleGroup::Deprecated, rules::pyupgrade::rules::UnpackedListComprehension),
|
||||
(Pyupgrade, "028") => (RuleGroup::Stable, rules::pyupgrade::rules::YieldInForLoop),
|
||||
(Pyupgrade, "029") => (RuleGroup::Stable, rules::pyupgrade::rules::UnnecessaryBuiltinImport),
|
||||
(Pyupgrade, "030") => (RuleGroup::Stable, rules::pyupgrade::rules::FormatLiterals),
|
||||
|
|
|
@ -7,13 +7,17 @@ use ruff_text_size::Ranged;
|
|||
|
||||
use crate::checkers::ast::Checker;
|
||||
|
||||
/// ## Deprecation
|
||||
/// There's no [evidence](https://github.com/astral-sh/ruff/issues/12754) that generators are
|
||||
/// meaningfully faster than list comprehensions when combined with unpacking.
|
||||
///
|
||||
/// ## What it does
|
||||
/// Checks for list comprehensions that are immediately unpacked.
|
||||
///
|
||||
/// ## Why is this bad?
|
||||
/// There is no reason to use a list comprehension if the result is immediately
|
||||
/// unpacked. Instead, use a generator expression, which is more efficient as
|
||||
/// it avoids allocating an intermediary list.
|
||||
/// unpacked. Instead, use a generator expression, which avoids allocating
|
||||
/// an intermediary list.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue