mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-19 01:51:30 +00:00
Remove some unused pub
functions (#11576)
## Summary I left anything in `red-knot`, any `with_` methods, etc.
This commit is contained in:
parent
3989cb8b56
commit
16acd4913f
14 changed files with 7 additions and 495 deletions
|
@ -59,10 +59,6 @@ impl<'a> QualifiedName<'a> {
|
|||
matches!(self.segments(), ["", ..])
|
||||
}
|
||||
|
||||
pub fn is_user_defined(&self) -> bool {
|
||||
!self.is_builtin()
|
||||
}
|
||||
|
||||
/// If the call path is dot-prefixed, it's an unresolved relative import.
|
||||
/// Ex) `[".foo", "bar"]` -> `".foo.bar"`
|
||||
pub fn is_unresolved_import(&self) -> bool {
|
||||
|
|
|
@ -3729,20 +3729,6 @@ impl fmt::Display for IpyEscapeKind {
|
|||
}
|
||||
|
||||
impl IpyEscapeKind {
|
||||
/// Returns the length of the escape kind token.
|
||||
pub fn prefix_len(self) -> TextSize {
|
||||
let len = match self {
|
||||
IpyEscapeKind::Shell
|
||||
| IpyEscapeKind::Magic
|
||||
| IpyEscapeKind::Help
|
||||
| IpyEscapeKind::Quote
|
||||
| IpyEscapeKind::Quote2
|
||||
| IpyEscapeKind::Paren => 1,
|
||||
IpyEscapeKind::ShCap | IpyEscapeKind::Magic2 | IpyEscapeKind::Help2 => 2,
|
||||
};
|
||||
len.into()
|
||||
}
|
||||
|
||||
/// Returns `true` if the escape kind is help i.e., `?` or `??`.
|
||||
pub const fn is_help(self) -> bool {
|
||||
matches!(self, IpyEscapeKind::Help | IpyEscapeKind::Help2)
|
||||
|
|
|
@ -79,15 +79,3 @@ pub fn next_sibling<'a>(stmt: &'a Stmt, suite: &'a Suite) -> Option<&'a Stmt> {
|
|||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Given a [`Stmt`] and its containing [`Suite`], return the previous [`Stmt`] in the [`Suite`].
|
||||
pub fn prev_sibling<'a>(stmt: &'a Stmt, suite: &'a Suite) -> Option<&'a Stmt> {
|
||||
let mut prev = None;
|
||||
for sibling in suite {
|
||||
if sibling == stmt {
|
||||
return prev;
|
||||
}
|
||||
prev = Some(sibling);
|
||||
}
|
||||
None
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue