diff options
Diffstat (limited to 'crates/ide')
-rw-r--r-- | crates/ide/src/diagnostics.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs index 038273750..79d126ff2 100644 --- a/crates/ide/src/diagnostics.rs +++ b/crates/ide/src/diagnostics.rs | |||
@@ -199,6 +199,12 @@ fn check_unnecessary_braces_in_use_statement( | |||
199 | ) -> Option<()> { | 199 | ) -> Option<()> { |
200 | let use_tree_list = ast::UseTreeList::cast(node.clone())?; | 200 | let use_tree_list = ast::UseTreeList::cast(node.clone())?; |
201 | if let Some((single_use_tree,)) = use_tree_list.use_trees().collect_tuple() { | 201 | if let Some((single_use_tree,)) = use_tree_list.use_trees().collect_tuple() { |
202 | // If there is a comment inside the bracketed `use`, | ||
203 | // assume it is a commented out module path and don't show diagnostic. | ||
204 | if use_tree_list.has_inner_comment() { | ||
205 | return Some(()); | ||
206 | } | ||
207 | |||
202 | let use_range = use_tree_list.syntax().text_range(); | 208 | let use_range = use_tree_list.syntax().text_range(); |
203 | let edit = | 209 | let edit = |
204 | text_edit_for_remove_unnecessary_braces_with_self_in_use_statement(&single_use_tree) | 210 | text_edit_for_remove_unnecessary_braces_with_self_in_use_statement(&single_use_tree) |
@@ -638,6 +644,22 @@ mod a { | |||
638 | } | 644 | } |
639 | "#, | 645 | "#, |
640 | ); | 646 | ); |
647 | check_no_diagnostics( | ||
648 | r#" | ||
649 | use a; | ||
650 | use a::{ | ||
651 | c, | ||
652 | // d::e | ||
653 | }; | ||
654 | |||
655 | mod a { | ||
656 | mod c {} | ||
657 | mod d { | ||
658 | mod e {} | ||
659 | } | ||
660 | } | ||
661 | "#, | ||
662 | ); | ||
641 | check_fix( | 663 | check_fix( |
642 | r" | 664 | r" |
643 | mod b {} | 665 | mod b {} |