mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-17 11:03:00 +00:00
[ty] Refactor: Use let-chains in a few places (#20985)
This commit is contained in:
parent
44e678a222
commit
54cd9d889d
4 changed files with 66 additions and 70 deletions
|
|
@ -527,20 +527,19 @@ impl<'db> SemanticIndex<'db> {
|
|||
break;
|
||||
}
|
||||
if !ancestor_scope.is_eager() {
|
||||
if let PlaceExprRef::Symbol(symbol) = expr {
|
||||
if let Some(place_id) =
|
||||
if let PlaceExprRef::Symbol(symbol) = expr
|
||||
&& let Some(place_id) =
|
||||
self.place_tables[enclosing_scope].symbol_id(symbol.name())
|
||||
{
|
||||
let key = EnclosingSnapshotKey {
|
||||
enclosing_scope,
|
||||
enclosing_place: place_id.into(),
|
||||
nested_scope,
|
||||
nested_laziness: ScopeLaziness::Lazy,
|
||||
};
|
||||
if let Some(id) = self.enclosing_snapshots.get(&key) {
|
||||
return self.use_def_maps[enclosing_scope]
|
||||
.enclosing_snapshot(*id, key.nested_laziness);
|
||||
}
|
||||
{
|
||||
let key = EnclosingSnapshotKey {
|
||||
enclosing_scope,
|
||||
enclosing_place: place_id.into(),
|
||||
nested_scope,
|
||||
nested_laziness: ScopeLaziness::Lazy,
|
||||
};
|
||||
if let Some(id) = self.enclosing_snapshots.get(&key) {
|
||||
return self.use_def_maps[enclosing_scope]
|
||||
.enclosing_snapshot(*id, key.nested_laziness);
|
||||
}
|
||||
}
|
||||
return EnclosingSnapshotResult::NoLongerInEagerContext;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue