mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 14:03:35 +00:00
Remove unwrap from Remove dbg
This commit is contained in:
parent
4bed01c36e
commit
b658f9a954
1 changed files with 1 additions and 4 deletions
|
@ -39,14 +39,11 @@ pub(crate) fn remove_dbg(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<(
|
|||
|
||||
let replacements =
|
||||
macro_calls.into_iter().filter_map(compute_dbg_replacement).collect::<Vec<_>>();
|
||||
if replacements.is_empty() {
|
||||
return None;
|
||||
}
|
||||
|
||||
acc.add(
|
||||
AssistId("remove_dbg", AssistKind::Refactor),
|
||||
"Remove dbg!()",
|
||||
replacements.iter().map(|&(range, _)| range).reduce(|acc, range| acc.cover(range)).unwrap(),
|
||||
replacements.iter().map(|&(range, _)| range).reduce(|acc, range| acc.cover(range))?,
|
||||
|builder| {
|
||||
for (range, expr) in replacements {
|
||||
if let Some(expr) = expr {
|
||||
|
|
Loading…
Reference in a new issue