mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 05:45:24 +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, "024") => (RuleGroup::Stable, rules::pyupgrade::rules::OSErrorAlias),
|
||||||
(Pyupgrade, "025") => (RuleGroup::Stable, rules::pyupgrade::rules::UnicodeKindPrefix),
|
(Pyupgrade, "025") => (RuleGroup::Stable, rules::pyupgrade::rules::UnicodeKindPrefix),
|
||||||
(Pyupgrade, "026") => (RuleGroup::Stable, rules::pyupgrade::rules::DeprecatedMockImport),
|
(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, "028") => (RuleGroup::Stable, rules::pyupgrade::rules::YieldInForLoop),
|
||||||
(Pyupgrade, "029") => (RuleGroup::Stable, rules::pyupgrade::rules::UnnecessaryBuiltinImport),
|
(Pyupgrade, "029") => (RuleGroup::Stable, rules::pyupgrade::rules::UnnecessaryBuiltinImport),
|
||||||
(Pyupgrade, "030") => (RuleGroup::Stable, rules::pyupgrade::rules::FormatLiterals),
|
(Pyupgrade, "030") => (RuleGroup::Stable, rules::pyupgrade::rules::FormatLiterals),
|
||||||
|
|
|
@ -7,13 +7,17 @@ use ruff_text_size::Ranged;
|
||||||
|
|
||||||
use crate::checkers::ast::Checker;
|
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
|
/// ## What it does
|
||||||
/// Checks for list comprehensions that are immediately unpacked.
|
/// Checks for list comprehensions that are immediately unpacked.
|
||||||
///
|
///
|
||||||
/// ## Why is this bad?
|
/// ## Why is this bad?
|
||||||
/// There is no reason to use a list comprehension if the result is immediately
|
/// 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
|
/// unpacked. Instead, use a generator expression, which avoids allocating
|
||||||
/// it avoids allocating an intermediary list.
|
/// an intermediary list.
|
||||||
///
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
/// ```python
|
/// ```python
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue