mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-28 10:39:45 +00:00
remove remove_default
This commit is contained in:
parent
a489123e80
commit
435b2962a0
3 changed files with 19 additions and 62 deletions
|
|
@ -406,42 +406,6 @@ impl ast::WhereClause {
|
|||
}
|
||||
}
|
||||
|
||||
impl ast::TypeParam {
|
||||
pub fn remove_default(&self) {
|
||||
if let Some((eq, last)) = self
|
||||
.syntax()
|
||||
.children_with_tokens()
|
||||
.find(|it| it.kind() == T![=])
|
||||
.zip(self.syntax().last_child_or_token())
|
||||
{
|
||||
ted::remove_all(eq..=last);
|
||||
|
||||
// remove any trailing ws
|
||||
if let Some(last) = self.syntax().last_token().filter(|it| it.kind() == WHITESPACE) {
|
||||
last.detach();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ast::ConstParam {
|
||||
pub fn remove_default(&self) {
|
||||
if let Some((eq, last)) = self
|
||||
.syntax()
|
||||
.children_with_tokens()
|
||||
.find(|it| it.kind() == T![=])
|
||||
.zip(self.syntax().last_child_or_token())
|
||||
{
|
||||
ted::remove_all(eq..=last);
|
||||
|
||||
// remove any trailing ws
|
||||
if let Some(last) = self.syntax().last_token().filter(|it| it.kind() == WHITESPACE) {
|
||||
last.detach();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Removable: AstNode {
|
||||
fn remove(&self);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue