diff options
author | Kirill Bulatov <[email protected]> | 2020-10-06 12:21:22 +0100 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2020-10-06 12:21:22 +0100 |
commit | af4ae86e2700209283333490da377767e00f5ed2 (patch) | |
tree | f390143fdb1feea0b6a32cef9fad7907538fb8ef /crates/assists/src | |
parent | cb78c40b0ed1e8cf609457d63c5137022d2e1907 (diff) |
Do not leave braces for colons in dbg!
Diffstat (limited to 'crates/assists/src')
-rw-r--r-- | crates/assists/src/handlers/remove_dbg.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/crates/assists/src/handlers/remove_dbg.rs b/crates/assists/src/handlers/remove_dbg.rs index a8ab2aecc..e10616779 100644 --- a/crates/assists/src/handlers/remove_dbg.rs +++ b/crates/assists/src/handlers/remove_dbg.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use syntax::{ | 1 | use syntax::{ |
2 | ast::{self, AstNode}, | 2 | ast::{self, AstNode}, |
3 | SyntaxElement, TextRange, TextSize, T, | 3 | SyntaxElement, SyntaxKind, TextRange, TextSize, T, |
4 | }; | 4 | }; |
5 | 5 | ||
6 | use crate::{AssistContext, AssistId, AssistKind, Assists}; | 6 | use crate::{AssistContext, AssistId, AssistKind, Assists}; |
@@ -117,7 +117,10 @@ fn needs_parentheses_around_macro_contents(macro_contents: Vec<SyntaxElement>) - | |||
117 | } | 117 | } |
118 | symbol_kind => { | 118 | symbol_kind => { |
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 && symbol_kind.is_punct() { | 120 | if symbol_not_in_bracket |
121 | && symbol_kind != SyntaxKind::COLON | ||
122 | && symbol_kind.is_punct() | ||
123 | { | ||
121 | return true; | 124 | return true; |
122 | } | 125 | } |
123 | } | 126 | } |
@@ -159,6 +162,8 @@ fn foo(n: usize) { | |||
159 | } | 162 | } |
160 | ", | 163 | ", |
161 | ); | 164 | ); |
165 | |||
166 | check_assist(remove_dbg, "<|>dbg!(Foo::foo_test()).bar()", "Foo::foo_test().bar()"); | ||
162 | } | 167 | } |
163 | 168 | ||
164 | #[test] | 169 | #[test] |