mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Use correct indent when replacing with match
This commit is contained in:
parent
53cc2c16e7
commit
8cad7d1a2b
3 changed files with 45 additions and 7 deletions
|
@ -579,12 +579,17 @@ pub trait AstNodeEdit: AstNode + Clone + Sized {
|
|||
rewriter.rewrite_ast(self)
|
||||
}
|
||||
#[must_use]
|
||||
fn indent(&self, indent: IndentLevel) -> Self {
|
||||
Self::cast(indent.increase_indent(self.syntax().clone())).unwrap()
|
||||
fn indent(&self, level: IndentLevel) -> Self {
|
||||
Self::cast(level.increase_indent(self.syntax().clone())).unwrap()
|
||||
}
|
||||
#[must_use]
|
||||
fn dedent(&self, indent: IndentLevel) -> Self {
|
||||
Self::cast(indent.decrease_indent(self.syntax().clone())).unwrap()
|
||||
fn dedent(&self, level: IndentLevel) -> Self {
|
||||
Self::cast(level.decrease_indent(self.syntax().clone())).unwrap()
|
||||
}
|
||||
#[must_use]
|
||||
fn reset_indent(&self) -> Self {
|
||||
let level = IndentLevel::from_node(self.syntax());
|
||||
self.dedent(level)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue