diff options
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r-- | crates/ra_assists/src/handlers/remove_dbg.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/crates/ra_assists/src/handlers/remove_dbg.rs b/crates/ra_assists/src/handlers/remove_dbg.rs index a616cca57..e19620d5a 100644 --- a/crates/ra_assists/src/handlers/remove_dbg.rs +++ b/crates/ra_assists/src/handlers/remove_dbg.rs | |||
@@ -126,4 +126,25 @@ fn foo(n: usize) { | |||
126 | "dbg!(n.checked_sub(4))", | 126 | "dbg!(n.checked_sub(4))", |
127 | ); | 127 | ); |
128 | } | 128 | } |
129 | |||
130 | #[test] | ||
131 | fn remove_dbg_leave_semicolon() { | ||
132 | // https://github.com/rust-analyzer/rust-analyzer/issues/5129#issuecomment-651399779 | ||
133 | // not quite though | ||
134 | let code = " | ||
135 | let res = <|>dbg!(1 * 20); // needless comment | ||
136 | "; | ||
137 | let expected = " | ||
138 | let res = 1 * 20; // needless comment | ||
139 | "; | ||
140 | check_assist(remove_dbg, code, expected); | ||
141 | } | ||
142 | |||
143 | #[test] | ||
144 | fn remove_dbg_keep_expression() { | ||
145 | let code = " | ||
146 | let res = <|>dbg!(a + b).foo();"; | ||
147 | let expected = "let res = (a + b).foo();"; | ||
148 | check_assist(remove_dbg, code, expected); | ||
149 | } | ||
129 | } | 150 | } |