Skip to content

Commit 26f834e

Browse files
committed
Add remove ident for remove_dbg
1 parent 849e674 commit 26f834e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

crates/ide-assists/src/handlers/remove_dbg.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ fn compute_dbg_replacement(
112112
}
113113
}
114114
}
115-
// dbg!(2, 'x', ...); or dbg!(&x);
115+
// dbg!(2, 'x', &x, x, ...);
116116
exprs if ast::ExprStmt::can_cast(parent.kind()) && exprs.iter().all(pure_expr) => {
117117
let mut replace = vec![parent.clone().into()];
118118
if let Some(prev_sibling) = parent.prev_sibling_or_token()
@@ -181,6 +181,7 @@ fn pure_expr(expr: &ast::Expr) -> bool {
181181
matches!(it.expr(), Some(ast::Expr::PathExpr(p))
182182
if p.path().and_then(|p| p.as_single_name_ref()).is_some())
183183
},
184+
ast::PathExpr(it) => it.path().and_then(|it| it.as_single_name_ref()).is_some(),
184185
_ => false,
185186
}
186187
}
@@ -266,6 +267,7 @@ fn foo() {
266267
dbg!(1, 2.5);
267268
dbg!('x');
268269
dbg!(&n);
270+
dbg!(n);
269271
// needless comment
270272
dbg!("foo");$0
271273
}

0 commit comments

Comments
 (0)