mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 06:11:43 +00:00
Remove sloppy match_name_or_attr helper (#1027)
This commit is contained in:
parent
4b0c3e3bc9
commit
dbb1a6e44b
7 changed files with 47 additions and 36 deletions
|
@ -61,15 +61,6 @@ pub fn dealias_call_path<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
/// Return `true` if the `Expr` is a name or attribute reference to `${target}`.
|
||||
pub fn match_name_or_attr(expr: &Expr, target: &str) -> bool {
|
||||
match &expr.node {
|
||||
ExprKind::Attribute { attr, .. } => target == attr,
|
||||
ExprKind::Name { id, .. } => target == id,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Return `true` if the `Expr` is a reference to `${module}.${target}`.
|
||||
///
|
||||
/// Useful for, e.g., ensuring that a `Union` reference represents
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue