mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 20:42:10 +00:00
Refine SemanticModel lifetime bounds (#10221)
## Summary Corrects/refines some semantic model and related lifetime bounds. ## Test Plan `cargo check`
This commit is contained in:
parent
4eac9baf43
commit
64f66cd8fe
7 changed files with 46 additions and 40 deletions
|
@ -95,7 +95,7 @@ impl<'a> Scope<'a> {
|
|||
}
|
||||
|
||||
/// Returns a tuple of the name and ID of all bindings defined in this scope.
|
||||
pub fn bindings(&self) -> impl Iterator<Item = (&str, BindingId)> + '_ {
|
||||
pub fn bindings(&self) -> impl Iterator<Item = (&'a str, BindingId)> + '_ {
|
||||
self.bindings.iter().map(|(&name, &id)| (name, id))
|
||||
}
|
||||
|
||||
|
@ -238,7 +238,7 @@ impl<'a> Scopes<'a> {
|
|||
}
|
||||
|
||||
/// Returns an iterator over all [`Scope`] ancestors, starting from the given [`ScopeId`].
|
||||
pub fn ancestors(&self, scope_id: ScopeId) -> impl Iterator<Item = &Scope> + '_ {
|
||||
pub fn ancestors(&self, scope_id: ScopeId) -> impl Iterator<Item = &Scope<'a>> + '_ {
|
||||
std::iter::successors(Some(&self[scope_id]), |&scope| {
|
||||
scope.parent.map(|scope_id| &self[scope_id])
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue