Skip to content

Commit 2cfb671

Browse files
committed
refactor: one unbound is as good as another
1 parent fb4f142 commit 2cfb671

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

crates/ty_python_semantic/src/types.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8338,21 +8338,18 @@ impl<'db> ModuleLiteralType<'db> {
83388338
}
83398339
}
83408340

8341-
let result = self
8341+
let place_and_qualifiers = self
83428342
.module(db)
83438343
.file(db)
83448344
.map(|file| imported_symbol(db, file, name, None))
83458345
.unwrap_or_default();
83468346

8347-
// If the normal lookup failed, try to call the module's __getattr__ function
8348-
if result.place.is_unbound() {
8349-
let getattr_result = self.try_module_getattr(db, name);
8350-
if !getattr_result.place.is_unbound() {
8351-
return getattr_result;
8352-
}
8347+
// If the normal lookup failed, try to call the module's `__getattr__` function
8348+
if place_and_qualifiers.place.is_unbound() {
8349+
return self.try_module_getattr(db, name);
83538350
}
83548351

8355-
result
8352+
place_and_qualifiers
83568353
}
83578354
}
83588355

0 commit comments

Comments
 (0)