mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 20:43:21 +00:00
unindent -> dedent
This commit is contained in:
parent
231fddab54
commit
5c04d8544c
3 changed files with 3 additions and 3 deletions
|
@ -156,7 +156,7 @@ pub(crate) fn convert_to_guarded_return(acc: &mut Assists, ctx: &AssistContext)
|
||||||
parent_block: &ast::BlockExpr,
|
parent_block: &ast::BlockExpr,
|
||||||
if_expr: &ast::IfExpr,
|
if_expr: &ast::IfExpr,
|
||||||
) -> SyntaxNode {
|
) -> SyntaxNode {
|
||||||
let then_block_items = then_block.unindent(IndentLevel::from(1));
|
let then_block_items = then_block.dedent(IndentLevel::from(1));
|
||||||
let end_of_then = then_block_items.syntax().last_child_or_token().unwrap();
|
let end_of_then = then_block_items.syntax().last_child_or_token().unwrap();
|
||||||
let end_of_then =
|
let end_of_then =
|
||||||
if end_of_then.prev_sibling_or_token().map(|n| n.kind()) == Some(WHITESPACE) {
|
if end_of_then.prev_sibling_or_token().map(|n| n.kind()) == Some(WHITESPACE) {
|
||||||
|
|
|
@ -555,7 +555,7 @@ pub trait AstNodeEdit: AstNode + Clone + Sized {
|
||||||
Self::cast(indent.increase_indent(self.syntax().clone())).unwrap()
|
Self::cast(indent.increase_indent(self.syntax().clone())).unwrap()
|
||||||
}
|
}
|
||||||
#[must_use]
|
#[must_use]
|
||||||
fn unindent(&self, indent: IndentLevel) -> Self {
|
fn dedent(&self, indent: IndentLevel) -> Self {
|
||||||
Self::cast(indent.decrease_indent(self.syntax().clone())).unwrap()
|
Self::cast(indent.decrease_indent(self.syntax().clone())).unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,7 +270,7 @@ fn parse_fixture_checks_further_indented_metadata() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_fixture_can_handle_unindented_first_line() {
|
fn parse_fixture_can_handle_dedented_first_line() {
|
||||||
let fixture = "//- /lib.rs
|
let fixture = "//- /lib.rs
|
||||||
mod foo;
|
mod foo;
|
||||||
//- /foo.rs
|
//- /foo.rs
|
||||||
|
|
Loading…
Reference in a new issue