aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ide_assists/src/handlers/remove_dbg.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/crates/ide_assists/src/handlers/remove_dbg.rs b/crates/ide_assists/src/handlers/remove_dbg.rs
index 6114091f2..e0e110c70 100644
--- a/crates/ide_assists/src/handlers/remove_dbg.rs
+++ b/crates/ide_assists/src/handlers/remove_dbg.rs
@@ -94,15 +94,11 @@ fn get_valid_macrocall_contents(
94 let mut contents_between_brackets = children_with_tokens.collect::<Vec<_>>(); 94 let mut contents_between_brackets = children_with_tokens.collect::<Vec<_>>();
95 let last_child = contents_between_brackets.pop()?; 95 let last_child = contents_between_brackets.pop()?;
96 96
97 if contents_between_brackets.is_empty() { 97 match (first_child.kind(), last_child.kind()) {
98 None 98 (T!['('], T![')']) | (T!['['], T![']']) | (T!['{'], T!['}']) => {
99 } else { 99 Some(contents_between_brackets)
100 match (first_child.kind(), last_child.kind()) {
101 (T!['('], T![')']) | (T!['['], T![']']) | (T!['{'], T!['}']) => {
102 Some(contents_between_brackets)
103 }
104 _ => None,
105 } 100 }
101 _ => None,
106 } 102 }
107} 103}
108 104
@@ -418,4 +414,9 @@ fn main() {
418}"#, 414}"#,
419 ); 415 );
420 } 416 }
417
418 #[test]
419 fn test_remove_empty_dbg() {
420 check_assist(remove_dbg, r#"$0dbg!()"#, r#""#);
421 }
421} 422}