From 19f972a305eef81d8081c338e6d24125e41e4104 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Tue, 13 Jun 2023 11:59:53 -0400 Subject: [PATCH] Use `Scope#has` in lieu of `Scope#get` (#5051) ## Summary These usages don't actually need the `BindingId`. --- crates/ruff_python_semantic/src/model.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/ruff_python_semantic/src/model.rs b/crates/ruff_python_semantic/src/model.rs index 0edd9451ca..e7bd442985 100644 --- a/crates/ruff_python_semantic/src/model.rs +++ b/crates/ruff_python_semantic/src/model.rs @@ -405,7 +405,7 @@ impl<'a> SemanticModel<'a> { if self .scopes() .take(scope_index) - .all(|scope| scope.get(name).is_none()) + .all(|scope| !scope.has(name)) { return Some(ImportedName { name: format!("{name}.{member}"), @@ -428,7 +428,7 @@ impl<'a> SemanticModel<'a> { if self .scopes() .take(scope_index) - .all(|scope| scope.get(name).is_none()) + .all(|scope| !scope.has(name)) { return Some(ImportedName { name: (*name).to_string(), @@ -449,7 +449,7 @@ impl<'a> SemanticModel<'a> { if self .scopes() .take(scope_index) - .all(|scope| scope.get(name).is_none()) + .all(|scope| !scope.has(name)) { return Some(ImportedName { name: format!("{name}.{member}"),