mirror of https://github.com/astral-sh/ruff
Use `Scope#has` in lieu of `Scope#get` (#5051)
## Summary These usages don't actually need the `BindingId`.
This commit is contained in:
parent
b0f89fa814
commit
19f972a305
|
|
@ -405,7 +405,7 @@ impl<'a> SemanticModel<'a> {
|
||||||
if self
|
if self
|
||||||
.scopes()
|
.scopes()
|
||||||
.take(scope_index)
|
.take(scope_index)
|
||||||
.all(|scope| scope.get(name).is_none())
|
.all(|scope| !scope.has(name))
|
||||||
{
|
{
|
||||||
return Some(ImportedName {
|
return Some(ImportedName {
|
||||||
name: format!("{name}.{member}"),
|
name: format!("{name}.{member}"),
|
||||||
|
|
@ -428,7 +428,7 @@ impl<'a> SemanticModel<'a> {
|
||||||
if self
|
if self
|
||||||
.scopes()
|
.scopes()
|
||||||
.take(scope_index)
|
.take(scope_index)
|
||||||
.all(|scope| scope.get(name).is_none())
|
.all(|scope| !scope.has(name))
|
||||||
{
|
{
|
||||||
return Some(ImportedName {
|
return Some(ImportedName {
|
||||||
name: (*name).to_string(),
|
name: (*name).to_string(),
|
||||||
|
|
@ -449,7 +449,7 @@ impl<'a> SemanticModel<'a> {
|
||||||
if self
|
if self
|
||||||
.scopes()
|
.scopes()
|
||||||
.take(scope_index)
|
.take(scope_index)
|
||||||
.all(|scope| scope.get(name).is_none())
|
.all(|scope| !scope.has(name))
|
||||||
{
|
{
|
||||||
return Some(ImportedName {
|
return Some(ImportedName {
|
||||||
name: format!("{name}.{member}"),
|
name: format!("{name}.{member}"),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue