diff options
author | Aleksey Kladov <[email protected]> | 2020-06-09 11:38:47 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-06-09 11:38:47 +0100 |
commit | 8cad7d1a2b2546986aa8f42207875b1c8eed948a (patch) | |
tree | b8f649d0d2aa56c57cc66f9ea287f4d85bcf463e /crates/ra_syntax | |
parent | 53cc2c16e7a53660fb7322d96284ef199699e250 (diff) |
Use correct indent when replacing with match
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r-- | crates/ra_syntax/src/ast/edit.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs index 29eb3fcb9..2ef173a03 100644 --- a/crates/ra_syntax/src/ast/edit.rs +++ b/crates/ra_syntax/src/ast/edit.rs | |||
@@ -579,12 +579,17 @@ pub trait AstNodeEdit: AstNode + Clone + Sized { | |||
579 | rewriter.rewrite_ast(self) | 579 | rewriter.rewrite_ast(self) |
580 | } | 580 | } |
581 | #[must_use] | 581 | #[must_use] |
582 | fn indent(&self, indent: IndentLevel) -> Self { | 582 | fn indent(&self, level: IndentLevel) -> Self { |
583 | Self::cast(indent.increase_indent(self.syntax().clone())).unwrap() | 583 | Self::cast(level.increase_indent(self.syntax().clone())).unwrap() |
584 | } | 584 | } |
585 | #[must_use] | 585 | #[must_use] |
586 | fn dedent(&self, indent: IndentLevel) -> Self { | 586 | fn dedent(&self, level: IndentLevel) -> Self { |
587 | Self::cast(indent.decrease_indent(self.syntax().clone())).unwrap() | 587 | Self::cast(level.decrease_indent(self.syntax().clone())).unwrap() |
588 | } | ||
589 | #[must_use] | ||
590 | fn reset_indent(&self) -> Self { | ||
591 | let level = IndentLevel::from_node(self.syntax()); | ||
592 | self.dedent(level) | ||
588 | } | 593 | } |
589 | } | 594 | } |
590 | 595 | ||