diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-05-09 13:49:18 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-05-09 13:49:18 +0100 |
commit | c5c07c2a0a1b4809c5aacef3c8e90034d00c3b03 (patch) | |
tree | fd0c84925abfcfcd853e62b81ea8ab5c9fca8818 | |
parent | 5af66e54866b2b9942b2a5298a8874ce6a44a1d5 (diff) | |
parent | 5c04d8544c647e1f9bbf3c5a2f1e86409d4080f5 (diff) |
Merge #4388
4388: unindent -> dedent r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r-- | crates/ra_assists/src/handlers/early_return.rs | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/edit.rs | 2 | ||||
-rw-r--r-- | crates/test_utils/src/lib.rs | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_assists/src/handlers/early_return.rs b/crates/ra_assists/src/handlers/early_return.rs index 0f2914950..66b296081 100644 --- a/crates/ra_assists/src/handlers/early_return.rs +++ b/crates/ra_assists/src/handlers/early_return.rs | |||
@@ -156,7 +156,7 @@ pub(crate) fn convert_to_guarded_return(acc: &mut Assists, ctx: &AssistContext) | |||
156 | parent_block: &ast::BlockExpr, | 156 | parent_block: &ast::BlockExpr, |
157 | if_expr: &ast::IfExpr, | 157 | if_expr: &ast::IfExpr, |
158 | ) -> SyntaxNode { | 158 | ) -> SyntaxNode { |
159 | let then_block_items = then_block.unindent(IndentLevel::from(1)); | 159 | let then_block_items = then_block.dedent(IndentLevel::from(1)); |
160 | let end_of_then = then_block_items.syntax().last_child_or_token().unwrap(); | 160 | let end_of_then = then_block_items.syntax().last_child_or_token().unwrap(); |
161 | let end_of_then = | 161 | let end_of_then = |
162 | if end_of_then.prev_sibling_or_token().map(|n| n.kind()) == Some(WHITESPACE) { | 162 | if end_of_then.prev_sibling_or_token().map(|n| n.kind()) == Some(WHITESPACE) { |
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs index 94dfb1a13..24a1e1d91 100644 --- a/crates/ra_syntax/src/ast/edit.rs +++ b/crates/ra_syntax/src/ast/edit.rs | |||
@@ -555,7 +555,7 @@ pub trait AstNodeEdit: AstNode + Clone + Sized { | |||
555 | Self::cast(indent.increase_indent(self.syntax().clone())).unwrap() | 555 | Self::cast(indent.increase_indent(self.syntax().clone())).unwrap() |
556 | } | 556 | } |
557 | #[must_use] | 557 | #[must_use] |
558 | fn unindent(&self, indent: IndentLevel) -> Self { | 558 | fn dedent(&self, indent: IndentLevel) -> Self { |
559 | Self::cast(indent.decrease_indent(self.syntax().clone())).unwrap() | 559 | Self::cast(indent.decrease_indent(self.syntax().clone())).unwrap() |
560 | } | 560 | } |
561 | } | 561 | } |
diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs index b13e13af2..b1e3c328f 100644 --- a/crates/test_utils/src/lib.rs +++ b/crates/test_utils/src/lib.rs | |||
@@ -270,7 +270,7 @@ fn parse_fixture_checks_further_indented_metadata() { | |||
270 | } | 270 | } |
271 | 271 | ||
272 | #[test] | 272 | #[test] |
273 | fn parse_fixture_can_handle_unindented_first_line() { | 273 | fn parse_fixture_can_handle_dedented_first_line() { |
274 | let fixture = "//- /lib.rs | 274 | let fixture = "//- /lib.rs |
275 | mod foo; | 275 | mod foo; |
276 | //- /foo.rs | 276 | //- /foo.rs |