diff options
Diffstat (limited to 'crates/ra_assists/src/remove_dbg.rs')
-rw-r--r-- | crates/ra_assists/src/remove_dbg.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/crates/ra_assists/src/remove_dbg.rs b/crates/ra_assists/src/remove_dbg.rs index ae9958f11..6e900f8ef 100644 --- a/crates/ra_assists/src/remove_dbg.rs +++ b/crates/ra_assists/src/remove_dbg.rs | |||
@@ -2,9 +2,7 @@ use hir::db::HirDatabase; | |||
2 | use ra_syntax::{ | 2 | use ra_syntax::{ |
3 | ast::{self, AstNode}, | 3 | ast::{self, AstNode}, |
4 | TextUnit, | 4 | TextUnit, |
5 | SyntaxKind::{ | 5 | T |
6 | L_PAREN, R_PAREN, L_CURLY, R_CURLY, L_BRACK, R_BRACK, EXCL | ||
7 | }, | ||
8 | }; | 6 | }; |
9 | use crate::{AssistCtx, Assist, AssistId}; | 7 | use crate::{AssistCtx, Assist, AssistId}; |
10 | 8 | ||
@@ -64,7 +62,7 @@ fn is_valid_macrocall(macro_call: &ast::MacroCall, macro_name: &str) -> Option<b | |||
64 | // Make sure it is actually a dbg-macro call, dbg followed by ! | 62 | // Make sure it is actually a dbg-macro call, dbg followed by ! |
65 | let excl = path.syntax().next_sibling_or_token()?; | 63 | let excl = path.syntax().next_sibling_or_token()?; |
66 | 64 | ||
67 | if name_ref.text() != macro_name || excl.kind() != EXCL { | 65 | if name_ref.text() != macro_name || excl.kind() != T![!] { |
68 | return None; | 66 | return None; |
69 | } | 67 | } |
70 | 68 | ||
@@ -73,7 +71,7 @@ fn is_valid_macrocall(macro_call: &ast::MacroCall, macro_name: &str) -> Option<b | |||
73 | let last_child = node.last_child_or_token()?; | 71 | let last_child = node.last_child_or_token()?; |
74 | 72 | ||
75 | match (first_child.kind(), last_child.kind()) { | 73 | match (first_child.kind(), last_child.kind()) { |
76 | (L_PAREN, R_PAREN) | (L_BRACK, R_BRACK) | (L_CURLY, R_CURLY) => Some(true), | 74 | (T!['('], T![')']) | (T!['['], T![']']) | (T!['{'], T!['}']) => Some(true), |
77 | _ => Some(false), | 75 | _ => Some(false), |
78 | } | 76 | } |
79 | } | 77 | } |