Merge pull request #18415 from lnicola/nicer-remove-dbg

fix: Turn "Remove `dbg!`" into a quick fix for better prioritization
This commit is contained in:
Laurențiu Nicola 2024-10-26 06:21:26 +00:00 committed by GitHub
commit 26d2fbaef2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View file

@ -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<_>>(); macro_calls.into_iter().filter_map(compute_dbg_replacement).collect::<Vec<_>>();
acc.add( acc.add(
AssistId("remove_dbg", AssistKind::Refactor), AssistId("remove_dbg", AssistKind::QuickFix),
"Remove dbg!()", "Remove dbg!()",
replacements.iter().map(|&(range, _)| range).reduce(|acc, range| acc.cover(range))?, replacements.iter().map(|&(range, _)| range).reduce(|acc, range| acc.cover(range))?,
|builder| { |builder| {

View file

@ -301,6 +301,7 @@ mod handlers {
inline_call::inline_into_callers, inline_call::inline_into_callers,
inline_const_as_literal::inline_const_as_literal, inline_const_as_literal::inline_const_as_literal,
inline_local_variable::inline_local_variable, inline_local_variable::inline_local_variable,
inline_macro::inline_macro,
inline_type_alias::inline_type_alias, inline_type_alias::inline_type_alias,
inline_type_alias::inline_type_alias_uses, inline_type_alias::inline_type_alias_uses,
into_to_qualified_from::into_to_qualified_from, into_to_qualified_from::into_to_qualified_from,
@ -326,6 +327,7 @@ mod handlers {
raw_string::add_hash, raw_string::add_hash,
raw_string::make_usual_string, raw_string::make_usual_string,
raw_string::remove_hash, raw_string::remove_hash,
remove_dbg::remove_dbg,
remove_mut::remove_mut, remove_mut::remove_mut,
remove_unused_imports::remove_unused_imports, remove_unused_imports::remove_unused_imports,
remove_unused_param::remove_unused_param, remove_unused_param::remove_unused_param,
@ -381,9 +383,6 @@ mod handlers {
generate_getter_or_setter::generate_setter, generate_getter_or_setter::generate_setter,
generate_delegate_methods::generate_delegate_methods, generate_delegate_methods::generate_delegate_methods,
generate_deref::generate_deref, 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 // Are you sure you want to add new assist here, and not to the
// sorted list above? // sorted list above?
] ]