diff options
-rw-r--r-- | crates/assists/src/handlers/remove_dbg.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/crates/assists/src/handlers/remove_dbg.rs b/crates/assists/src/handlers/remove_dbg.rs index e10616779..e7072d2b9 100644 --- a/crates/assists/src/handlers/remove_dbg.rs +++ b/crates/assists/src/handlers/remove_dbg.rs | |||
@@ -119,6 +119,7 @@ fn needs_parentheses_around_macro_contents(macro_contents: Vec<SyntaxElement>) - | |||
119 | let symbol_not_in_bracket = unpaired_brackets_in_contents.is_empty(); | 119 | let symbol_not_in_bracket = unpaired_brackets_in_contents.is_empty(); |
120 | if symbol_not_in_bracket | 120 | if symbol_not_in_bracket |
121 | && symbol_kind != SyntaxKind::COLON | 121 | && symbol_kind != SyntaxKind::COLON |
122 | && symbol_kind != SyntaxKind::DOT | ||
122 | && symbol_kind.is_punct() | 123 | && symbol_kind.is_punct() |
123 | { | 124 | { |
124 | return true; | 125 | return true; |
@@ -243,6 +244,25 @@ fn main() { | |||
243 | } | 244 | } |
244 | 245 | ||
245 | #[test] | 246 | #[test] |
247 | fn test_remove_dbg_method_chaining() { | ||
248 | check_assist( | ||
249 | remove_dbg, | ||
250 | r#"let res = <|>dbg!(foo().bar()).baz();"#, | ||
251 | r#"let res = foo().bar().baz();"#, | ||
252 | ); | ||
253 | check_assist( | ||
254 | remove_dbg, | ||
255 | r#"let res = <|>dbg!(foo.bar()).baz();"#, | ||
256 | r#"let res = foo.bar().baz();"#, | ||
257 | ); | ||
258 | } | ||
259 | |||
260 | #[test] | ||
261 | fn test_remove_dbg_field_chaining() { | ||
262 | check_assist(remove_dbg, r#"let res = <|>dbg!(foo.bar).baz;"#, r#"let res = foo.bar.baz;"#); | ||
263 | } | ||
264 | |||
265 | #[test] | ||
246 | fn test_remove_dbg_from_inside_fn() { | 266 | fn test_remove_dbg_from_inside_fn() { |
247 | check_assist_target( | 267 | check_assist_target( |
248 | remove_dbg, | 268 | remove_dbg, |