aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-12-24 18:39:31 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-12-24 18:39:31 +0000
commitb65ba8f1d62c2961e520885117056e405056959d (patch)
tree8b4b48b4e24c2b7fcf81ddc196586efd684a3c66 /crates/ra_analysis
parent67e768466ff2e2611eead0f30b2e9c4083c80c20 (diff)
parent0fb8894fbe3c2ea9f4be34065c3bd1b2a64f6356 (diff)
Merge #326
326: resolved #324: remove unnecessary braces in use statement. r=matklad a=gfreezy Add inspection for unnecessary braces in use statement Co-authored-by: gfreezy <[email protected]>
Diffstat (limited to 'crates/ra_analysis')
-rw-r--r--crates/ra_analysis/src/imp.rs5
-rw-r--r--crates/ra_analysis/src/lib.rs6
-rw-r--r--crates/ra_analysis/src/mock_analysis.rs2
-rw-r--r--crates/ra_analysis/tests/tests.rs3
4 files changed, 10 insertions, 6 deletions
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs
index 40996bfd7..a547c5a20 100644
--- a/crates/ra_analysis/src/imp.rs
+++ b/crates/ra_analysis/src/imp.rs
@@ -3,7 +3,7 @@ use std::{
3 sync::Arc, 3 sync::Arc,
4}; 4};
5 5
6use ra_editor::{self, find_node_at_offset, FileSymbol, LineIndex, LocalEdit}; 6use ra_editor::{self, find_node_at_offset, FileSymbol, LineIndex, LocalEdit, Severity};
7use ra_syntax::{ 7use ra_syntax::{
8 ast::{self, ArgListOwner, Expr, NameOwner, FnDef}, 8 ast::{self, ArgListOwner, Expr, NameOwner, FnDef},
9 algo::find_covering_node, 9 algo::find_covering_node,
@@ -365,6 +365,7 @@ impl AnalysisImpl {
365 .map(|d| Diagnostic { 365 .map(|d| Diagnostic {
366 range: d.range, 366 range: d.range,
367 message: d.msg, 367 message: d.msg,
368 severity: d.severity,
368 fix: None, 369 fix: None,
369 }) 370 })
370 .collect::<Vec<_>>(); 371 .collect::<Vec<_>>();
@@ -386,6 +387,7 @@ impl AnalysisImpl {
386 Diagnostic { 387 Diagnostic {
387 range: name_node.range(), 388 range: name_node.range(),
388 message: "unresolved module".to_string(), 389 message: "unresolved module".to_string(),
390 severity: Severity::Error,
389 fix: Some(fix), 391 fix: Some(fix),
390 } 392 }
391 } 393 }
@@ -408,6 +410,7 @@ impl AnalysisImpl {
408 Diagnostic { 410 Diagnostic {
409 range: name_node.range(), 411 range: name_node.range(),
410 message: "can't declare module at this location".to_string(), 412 message: "can't declare module at this location".to_string(),
413 severity: Severity::Error,
411 fix: Some(fix), 414 fix: Some(fix),
412 } 415 }
413 } 416 }
diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs
index 830898140..a029f66b4 100644
--- a/crates/ra_analysis/src/lib.rs
+++ b/crates/ra_analysis/src/lib.rs
@@ -29,11 +29,10 @@ use crate::{
29 symbol_index::SymbolIndex, 29 symbol_index::SymbolIndex,
30}; 30};
31 31
32pub use crate::{ 32pub use crate::completion::{CompletionItem, CompletionItemKind, InsertText};
33 completion::{CompletionItem, CompletionItemKind, InsertText},
34};
35pub use ra_editor::{ 33pub use ra_editor::{
36 FileSymbol, Fold, FoldKind, HighlightedRange, LineIndex, Runnable, RunnableKind, StructureNode, 34 FileSymbol, Fold, FoldKind, HighlightedRange, LineIndex, Runnable, RunnableKind, StructureNode,
35 Severity
37}; 36};
38pub use hir::FnSignatureInfo; 37pub use hir::FnSignatureInfo;
39 38
@@ -198,6 +197,7 @@ pub struct Diagnostic {
198 pub message: String, 197 pub message: String,
199 pub range: TextRange, 198 pub range: TextRange,
200 pub fix: Option<SourceChange>, 199 pub fix: Option<SourceChange>,
200 pub severity: Severity,
201} 201}
202 202
203#[derive(Debug)] 203#[derive(Debug)]
diff --git a/crates/ra_analysis/src/mock_analysis.rs b/crates/ra_analysis/src/mock_analysis.rs
index 7cbdfb953..5ce2aa2b4 100644
--- a/crates/ra_analysis/src/mock_analysis.rs
+++ b/crates/ra_analysis/src/mock_analysis.rs
@@ -1,6 +1,6 @@
1use std::sync::Arc; 1use std::sync::Arc;
2 2
3use relative_path::{RelativePathBuf}; 3use relative_path::RelativePathBuf;
4use test_utils::{extract_offset, parse_fixture, CURSOR_MARKER}; 4use test_utils::{extract_offset, parse_fixture, CURSOR_MARKER};
5use ra_db::mock::FileMap; 5use ra_db::mock::FileMap;
6 6
diff --git a/crates/ra_analysis/tests/tests.rs b/crates/ra_analysis/tests/tests.rs
index 938ca797a..210fa2a13 100644
--- a/crates/ra_analysis/tests/tests.rs
+++ b/crates/ra_analysis/tests/tests.rs
@@ -82,7 +82,8 @@ fn test_unresolved_module_diagnostic() {
82 label: "create module", 82 label: "create module",
83 source_file_edits: [], 83 source_file_edits: [],
84 file_system_edits: [CreateFile { source_root: SourceRootId(0), path: "foo.rs" }], 84 file_system_edits: [CreateFile { source_root: SourceRootId(0), path: "foo.rs" }],
85 cursor_position: None }) }]"#, 85 cursor_position: None }),
86 severity: Error }]"#,
86 &diagnostics, 87 &diagnostics,
87 ); 88 );
88} 89}