aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_assists/src
diff options
context:
space:
mode:
authorivan770 <[email protected]>2021-03-26 14:15:26 +0000
committerivan770 <[email protected]>2021-03-26 14:15:26 +0000
commit2292ff64f1d8460324236ac3f13af47553ad90b5 (patch)
tree2dedc9876d7ad9a5415fa2038b31232a3b912f5e /crates/ide_assists/src
parent4cb3ecce3ff2573c8473733b2538b32cd899b686 (diff)
Show dbg remove assist on empty contents
Diffstat (limited to 'crates/ide_assists/src')
-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}