Remove some unnecessary lifetime annotations (#5938)

This commit is contained in:
Charlie Marsh 2023-07-20 22:42:17 -04:00 committed by GitHub
parent 29e5e4e0b5
commit b3d31025b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 28 deletions

View file

@ -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.

View file

@ -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;
};

View file

@ -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 {

View file

@ -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;

View file

@ -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) {