aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/diagnostics.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-20 10:59:10 +0100
committerbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-20 10:59:10 +0100
commit6b352ffeb346eb7c7e46e00e790c2f395907eaa6 (patch)
treef19271365126259a7975dda9ee3e1e1496a299dd /crates/ra_ide_api/src/diagnostics.rs
parent2830d1376b05794c7bf1467fe52ad3bc0eb4ca41 (diff)
parentf3bdbec1b68fa0e20f0b7b6c6ef64e1507970b0d (diff)
Merge #1560
1560: move debug_dump to fmt::Debug r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/diagnostics.rs')
-rw-r--r--crates/ra_ide_api/src/diagnostics.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_ide_api/src/diagnostics.rs b/crates/ra_ide_api/src/diagnostics.rs
index affbad6cd..028dc3d4f 100644
--- a/crates/ra_ide_api/src/diagnostics.rs
+++ b/crates/ra_ide_api/src/diagnostics.rs
@@ -96,7 +96,7 @@ fn check_unnecessary_braces_in_use_statement(
96) -> Option<()> { 96) -> Option<()> {
97 let use_tree_list = ast::UseTreeList::cast(node.clone())?; 97 let use_tree_list = ast::UseTreeList::cast(node.clone())?;
98 if let Some((single_use_tree,)) = use_tree_list.use_trees().collect_tuple() { 98 if let Some((single_use_tree,)) = use_tree_list.use_trees().collect_tuple() {
99 let range = use_tree_list.syntax().range(); 99 let range = use_tree_list.syntax().text_range();
100 let edit = 100 let edit =
101 text_edit_for_remove_unnecessary_braces_with_self_in_use_statement(&single_use_tree) 101 text_edit_for_remove_unnecessary_braces_with_self_in_use_statement(&single_use_tree)
102 .unwrap_or_else(|| { 102 .unwrap_or_else(|| {
@@ -126,8 +126,8 @@ fn text_edit_for_remove_unnecessary_braces_with_self_in_use_statement(
126) -> Option<TextEdit> { 126) -> Option<TextEdit> {
127 let use_tree_list_node = single_use_tree.syntax().parent()?; 127 let use_tree_list_node = single_use_tree.syntax().parent()?;
128 if single_use_tree.path()?.segment()?.syntax().first_child_or_token()?.kind() == T![self] { 128 if single_use_tree.path()?.segment()?.syntax().first_child_or_token()?.kind() == T![self] {
129 let start = use_tree_list_node.prev_sibling_or_token()?.range().start(); 129 let start = use_tree_list_node.prev_sibling_or_token()?.text_range().start();
130 let end = use_tree_list_node.range().end(); 130 let end = use_tree_list_node.text_range().end();
131 let range = TextRange::from_to(start, end); 131 let range = TextRange::from_to(start, end);
132 let mut edit_builder = TextEditBuilder::default(); 132 let mut edit_builder = TextEditBuilder::default();
133 edit_builder.delete(range); 133 edit_builder.delete(range);
@@ -149,12 +149,12 @@ fn check_struct_shorthand_initialization(
149 let field_expr = expr.syntax().text().to_string(); 149 let field_expr = expr.syntax().text().to_string();
150 if field_name == field_expr { 150 if field_name == field_expr {
151 let mut edit_builder = TextEditBuilder::default(); 151 let mut edit_builder = TextEditBuilder::default();
152 edit_builder.delete(named_field.syntax().range()); 152 edit_builder.delete(named_field.syntax().text_range());
153 edit_builder.insert(named_field.syntax().range().start(), field_name); 153 edit_builder.insert(named_field.syntax().text_range().start(), field_name);
154 let edit = edit_builder.finish(); 154 let edit = edit_builder.finish();
155 155
156 acc.push(Diagnostic { 156 acc.push(Diagnostic {
157 range: named_field.syntax().range(), 157 range: named_field.syntax().text_range(),
158 message: "Shorthand struct initialization".to_string(), 158 message: "Shorthand struct initialization".to_string(),
159 severity: Severity::WeakWarning, 159 severity: Severity::WeakWarning,
160 fix: Some(SourceChange::source_file_edit( 160 fix: Some(SourceChange::source_file_edit(