mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-09 21:28:21 +00:00
Remove Statements#parent
(#6392)
Discussed in https://github.com/astral-sh/ruff/pull/6351#discussion_r1284997065.
This commit is contained in:
parent
e4a4660925
commit
9328606843
6 changed files with 12 additions and 17 deletions
|
@ -940,8 +940,10 @@ impl<'a> SemanticModel<'a> {
|
|||
|
||||
/// Given a [`Stmt`], return its parent, if any.
|
||||
#[inline]
|
||||
pub fn parent_statement(&self, statement: &'a Stmt) -> Option<&'a Stmt> {
|
||||
self.statements.parent(statement)
|
||||
pub fn parent_statement(&self, statement_id: StatementId) -> Option<&'a Stmt> {
|
||||
self.statements
|
||||
.parent_id(statement_id)
|
||||
.map(|id| self.statements[id])
|
||||
}
|
||||
|
||||
/// Set the [`Globals`] for the current [`Scope`].
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue