Remove `'b` lifetime from `Checker` (#3723)

This commit is contained in:
Charlie Marsh 2023-03-24 17:42:18 -04:00 committed by GitHub
parent c1d89d8c93
commit c721eedc37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 20 deletions

View File

@ -3966,10 +3966,7 @@ where
} }
impl<'a> Checker<'a> { impl<'a> Checker<'a> {
fn add_binding<'b>(&mut self, name: &'b str, binding: Binding<'a>) fn add_binding(&mut self, name: &'a str, binding: Binding<'a>) {
where
'b: 'a,
{
let binding_id = self.ctx.bindings.next_id(); let binding_id = self.ctx.bindings.next_id();
if let Some((stack_index, existing_binding_index)) = self if let Some((stack_index, existing_binding_index)) = self
.ctx .ctx
@ -4274,10 +4271,7 @@ impl<'a> Checker<'a> {
} }
} }
fn handle_node_store<'b>(&mut self, id: &'b str, expr: &Expr) fn handle_node_store(&mut self, id: &'a str, expr: &Expr) {
where
'b: 'a,
{
let parent = self.ctx.current_stmt().0; let parent = self.ctx.current_stmt().0;
if self.settings.rules.enabled(Rule::UndefinedLocal) { if self.settings.rules.enabled(Rule::UndefinedLocal) {
@ -4470,10 +4464,7 @@ impl<'a> Checker<'a> {
); );
} }
fn handle_node_delete<'b>(&mut self, expr: &'b Expr) fn handle_node_delete(&mut self, expr: &'a Expr) {
where
'b: 'a,
{
let ExprKind::Name { id, .. } = &expr.node else { let ExprKind::Name { id, .. } = &expr.node else {
return; return;
}; };
@ -4497,10 +4488,7 @@ impl<'a> Checker<'a> {
)); ));
} }
fn visit_docstring<'b>(&mut self, python_ast: &'b Suite) -> bool fn visit_docstring(&mut self, python_ast: &'a Suite) -> bool {
where
'b: 'a,
{
if self.settings.rules.enabled(Rule::FStringDocstring) { if self.settings.rules.enabled(Rule::FStringDocstring) {
flake8_bugbear::rules::f_string_docstring(self, python_ast); flake8_bugbear::rules::f_string_docstring(self, python_ast);
} }
@ -4537,10 +4525,7 @@ impl<'a> Checker<'a> {
} }
} }
fn check_deferred_string_type_definitions<'b>(&mut self, allocator: &'b mut Vec<Expr>) fn check_deferred_string_type_definitions(&mut self, allocator: &'a mut Vec<Expr>) {
where
'b: 'a,
{
let mut stacks = Vec::with_capacity(self.deferred.string_type_definitions.len()); let mut stacks = Vec::with_capacity(self.deferred.string_type_definitions.len());
self.deferred.string_type_definitions.reverse(); self.deferred.string_type_definitions.reverse();
while let Some((range, value, (in_annotation, in_type_checking_block), deferral)) = while let Some((range, value, (in_annotation, in_type_checking_block), deferral)) =