mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-16 23:24:03 +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 =
|
let replacements =
|
||||||
macro_calls.into_iter().filter_map(compute_dbg_replacement).collect::<Vec<_>>();
|
macro_calls.into_iter().filter_map(compute_dbg_replacement).collect::<Vec<_>>();
|
||||||
if replacements.is_empty() {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
acc.add(
|
acc.add(
|
||||||
AssistId("remove_dbg", AssistKind::Refactor),
|
AssistId("remove_dbg", AssistKind::Refactor),
|
||||||
"Remove dbg!()",
|
"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| {
|
|builder| {
|
||||||
for (range, expr) in replacements {
|
for (range, expr) in replacements {
|
||||||
if let Some(expr) = expr {
|
if let Some(expr) = expr {
|
||||||
|
|
Loading…
Reference in a new issue