diff options
author | ivan770 <[email protected]> | 2020-12-08 19:25:21 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-12-08 19:25:21 +0000 |
commit | 7738467e0a11c9878d9e9486daeb0dc18d93b8e8 (patch) | |
tree | 120deed19fa7f4e4789331f41ae6609ac8136ae4 /crates/ide | |
parent | f2950a135036a608ccdcff3f5da77561927d6952 (diff) |
Format code
Diffstat (limited to 'crates/ide')
-rw-r--r-- | crates/ide/src/diagnostics/fixes.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/crates/ide/src/diagnostics/fixes.rs b/crates/ide/src/diagnostics/fixes.rs index 7b05e87f2..c235b5bf4 100644 --- a/crates/ide/src/diagnostics/fixes.rs +++ b/crates/ide/src/diagnostics/fixes.rs | |||
@@ -13,7 +13,11 @@ use ide_db::{ | |||
13 | source_change::{FileSystemEdit, SourceFileEdit}, | 13 | source_change::{FileSystemEdit, SourceFileEdit}, |
14 | RootDatabase, | 14 | RootDatabase, |
15 | }; | 15 | }; |
16 | use syntax::{AstNode, Direction, T, algo, ast::{self, edit::IndentLevel, make}}; | 16 | use syntax::{ |
17 | algo, | ||
18 | ast::{self, edit::IndentLevel, make}, | ||
19 | AstNode, Direction, T, | ||
20 | }; | ||
17 | use text_edit::TextEdit; | 21 | use text_edit::TextEdit; |
18 | 22 | ||
19 | use crate::{diagnostics::Fix, references::rename::rename_with_semantics, FilePosition}; | 23 | use crate::{diagnostics::Fix, references::rename::rename_with_semantics, FilePosition}; |
@@ -102,7 +106,9 @@ impl DiagnosticWithFix for RemoveThisSemicolon { | |||
102 | fn fix(&self, sema: &Semantics<RootDatabase>) -> Option<Fix> { | 106 | fn fix(&self, sema: &Semantics<RootDatabase>) -> Option<Fix> { |
103 | let root = sema.db.parse_or_expand(self.file)?; | 107 | let root = sema.db.parse_or_expand(self.file)?; |
104 | 108 | ||
105 | let semicolon = self.expr.to_node(&root) | 109 | let semicolon = self |
110 | .expr | ||
111 | .to_node(&root) | ||
106 | .syntax() | 112 | .syntax() |
107 | .siblings_with_tokens(Direction::Next) | 113 | .siblings_with_tokens(Direction::Next) |
108 | .filter_map(|it| it.into_token()) | 114 | .filter_map(|it| it.into_token()) |
@@ -110,7 +116,8 @@ impl DiagnosticWithFix for RemoveThisSemicolon { | |||
110 | .text_range(); | 116 | .text_range(); |
111 | 117 | ||
112 | let edit = TextEdit::delete(semicolon); | 118 | let edit = TextEdit::delete(semicolon); |
113 | let source_change = SourceFileEdit { file_id: self.file.original_file(sema.db), edit }.into(); | 119 | let source_change = |
120 | SourceFileEdit { file_id: self.file.original_file(sema.db), edit }.into(); | ||
114 | 121 | ||
115 | Some(Fix::new("Remove this semicolon", source_change, semicolon)) | 122 | Some(Fix::new("Remove this semicolon", source_change, semicolon)) |
116 | } | 123 | } |