From 2292ff64f1d8460324236ac3f13af47553ad90b5 Mon Sep 17 00:00:00 2001 From: ivan770 Date: Fri, 26 Mar 2021 16:15:26 +0200 Subject: Show dbg remove assist on empty contents --- crates/ide_assists/src/handlers/remove_dbg.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'crates/ide_assists/src') 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( let mut contents_between_brackets = children_with_tokens.collect::>(); let last_child = contents_between_brackets.pop()?; - if contents_between_brackets.is_empty() { - None - } else { - match (first_child.kind(), last_child.kind()) { - (T!['('], T![')']) | (T!['['], T![']']) | (T!['{'], T!['}']) => { - Some(contents_between_brackets) - } - _ => None, + match (first_child.kind(), last_child.kind()) { + (T!['('], T![')']) | (T!['['], T![']']) | (T!['{'], T!['}']) => { + Some(contents_between_brackets) } + _ => None, } } @@ -418,4 +414,9 @@ fn main() { }"#, ); } + + #[test] + fn test_remove_empty_dbg() { + check_assist(remove_dbg, r#"$0dbg!()"#, r#""#); + } } -- cgit v1.2.3