Skip to content

Commit

Permalink
Merge pull request #18415 from lnicola/nicer-remove-dbg
Browse files Browse the repository at this point in the history
fix: Turn "Remove `dbg!`" into a quick fix for better prioritization
  • Loading branch information
lnicola authored Oct 26, 2024
2 parents f446671 + 4e3c331 commit 26d2fba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/ide-assists/src/handlers/remove_dbg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub(crate) fn remove_dbg(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<(
macro_calls.into_iter().filter_map(compute_dbg_replacement).collect::<Vec<_>>();

acc.add(
AssistId("remove_dbg", AssistKind::Refactor),
AssistId("remove_dbg", AssistKind::QuickFix),
"Remove dbg!()",
replacements.iter().map(|&(range, _)| range).reduce(|acc, range| acc.cover(range))?,
|builder| {
Expand Down
5 changes: 2 additions & 3 deletions crates/ide-assists/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ mod handlers {
inline_call::inline_into_callers,
inline_const_as_literal::inline_const_as_literal,
inline_local_variable::inline_local_variable,
inline_macro::inline_macro,
inline_type_alias::inline_type_alias,
inline_type_alias::inline_type_alias_uses,
into_to_qualified_from::into_to_qualified_from,
Expand All @@ -326,6 +327,7 @@ mod handlers {
raw_string::add_hash,
raw_string::make_usual_string,
raw_string::remove_hash,
remove_dbg::remove_dbg,
remove_mut::remove_mut,
remove_unused_imports::remove_unused_imports,
remove_unused_param::remove_unused_param,
Expand Down Expand Up @@ -381,9 +383,6 @@ mod handlers {
generate_getter_or_setter::generate_setter,
generate_delegate_methods::generate_delegate_methods,
generate_deref::generate_deref,
//
remove_dbg::remove_dbg,
inline_macro::inline_macro,
// Are you sure you want to add new assist here, and not to the
// sorted list above?
]
Expand Down

0 comments on commit 26d2fba

Please sign in to comment.