mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:24 +00:00
Remove some unnecessary lifetime annotations (#5938)
This commit is contained in:
parent
29e5e4e0b5
commit
b3d31025b1
5 changed files with 16 additions and 28 deletions
|
@ -49,13 +49,11 @@ impl AlwaysAutofixableViolation for DuplicateClassFieldDefinition {
|
|||
}
|
||||
|
||||
/// PIE794
|
||||
pub(crate) fn duplicate_class_field_definition<'a, 'b>(
|
||||
checker: &mut Checker<'a>,
|
||||
parent: &'b Stmt,
|
||||
body: &'b [Stmt],
|
||||
) where
|
||||
'b: 'a,
|
||||
{
|
||||
pub(crate) fn duplicate_class_field_definition(
|
||||
checker: &mut Checker,
|
||||
parent: &Stmt,
|
||||
body: &[Stmt],
|
||||
) {
|
||||
let mut seen_targets: FxHashSet<&str> = FxHashSet::default();
|
||||
for stmt in body {
|
||||
// Extract the property name from the assignment statement.
|
||||
|
|
|
@ -53,13 +53,7 @@ impl Violation for NonUniqueEnums {
|
|||
}
|
||||
|
||||
/// PIE796
|
||||
pub(crate) fn non_unique_enums<'a, 'b>(
|
||||
checker: &mut Checker<'a>,
|
||||
parent: &'b Stmt,
|
||||
body: &'b [Stmt],
|
||||
) where
|
||||
'b: 'a,
|
||||
{
|
||||
pub(crate) fn non_unique_enums(checker: &mut Checker, parent: &Stmt, body: &[Stmt]) {
|
||||
let Stmt::ClassDef(ast::StmtClassDef { bases, .. }) = parent else {
|
||||
return;
|
||||
};
|
||||
|
|
|
@ -44,10 +44,10 @@ impl Violation for EllipsisInNonEmptyClassBody {
|
|||
}
|
||||
|
||||
/// PYI013
|
||||
pub(crate) fn ellipsis_in_non_empty_class_body<'a>(
|
||||
checker: &mut Checker<'a>,
|
||||
parent: &'a Stmt,
|
||||
body: &'a [Stmt],
|
||||
pub(crate) fn ellipsis_in_non_empty_class_body(
|
||||
checker: &mut Checker,
|
||||
parent: &Stmt,
|
||||
body: &[Stmt],
|
||||
) {
|
||||
// If the class body contains a single statement, then it's fine for it to be an ellipsis.
|
||||
if body.len() == 1 {
|
||||
|
|
|
@ -22,11 +22,7 @@ impl AlwaysAutofixableViolation for PassInClassBody {
|
|||
}
|
||||
|
||||
/// PYI012
|
||||
pub(crate) fn pass_in_class_body<'a>(
|
||||
checker: &mut Checker<'a>,
|
||||
parent: &'a Stmt,
|
||||
body: &'a [Stmt],
|
||||
) {
|
||||
pub(crate) fn pass_in_class_body(checker: &mut Checker, parent: &Stmt, body: &[Stmt]) {
|
||||
// `pass` is required in these situations (or handled by `pass_statement_stub_body`).
|
||||
if body.len() < 2 {
|
||||
return;
|
||||
|
|
|
@ -44,11 +44,11 @@ impl AlwaysAutofixableViolation for UselessReturn {
|
|||
}
|
||||
|
||||
/// PLR1711
|
||||
pub(crate) fn useless_return<'a>(
|
||||
checker: &mut Checker<'a>,
|
||||
stmt: &'a Stmt,
|
||||
body: &'a [Stmt],
|
||||
returns: Option<&'a Expr>,
|
||||
pub(crate) fn useless_return(
|
||||
checker: &mut Checker,
|
||||
stmt: &Stmt,
|
||||
body: &[Stmt],
|
||||
returns: Option<&Expr>,
|
||||
) {
|
||||
// Skip functions that have a return annotation that is not `None`.
|
||||
if !returns.map_or(true, is_const_none) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue