mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-03 05:13:35 +00:00
Speed up resolving "Generate delegate method" assist (part 2)
Make it compile by adding a `None` subtype to rest of the AssistId instantiations.
This commit is contained in:
parent
7aa70a86d1
commit
f2ad0fcb21
133 changed files with 530 additions and 568 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use hir::{HasSource, HirDisplay, db::ExpandDatabase};
|
||||
use ide_db::text_edit::TextRange;
|
||||
use ide_db::{
|
||||
assists::{Assist, AssistId, AssistKind},
|
||||
assists::{Assist, AssistId},
|
||||
label::Label,
|
||||
source_change::SourceChangeBuilder,
|
||||
};
|
||||
|
|
@ -97,7 +97,7 @@ fn quickfix_for_redundant_assoc_item(
|
|||
add_assoc_item_def(&mut source_change_builder)?;
|
||||
|
||||
Some(vec![Assist {
|
||||
id: AssistId("add assoc item def into trait def", AssistKind::QuickFix),
|
||||
id: AssistId::quick_fix("add assoc item def into trait def"),
|
||||
label: Label::new("Add assoc item def into trait def".to_owned()),
|
||||
group: None,
|
||||
target: range,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use hir::{
|
|||
};
|
||||
use ide_db::text_edit::TextEdit;
|
||||
use ide_db::{
|
||||
assists::{Assist, AssistId, AssistKind, GroupLabel},
|
||||
assists::{Assist, AssistId, GroupLabel},
|
||||
label::Label,
|
||||
source_change::SourceChange,
|
||||
};
|
||||
|
|
@ -78,7 +78,7 @@ fn fixes(ctx: &DiagnosticsContext<'_>, d: &hir::TypedHole) -> Option<Vec<Assist>
|
|||
})
|
||||
.unique()
|
||||
.map(|code| Assist {
|
||||
id: AssistId("typed-hole", AssistKind::QuickFix),
|
||||
id: AssistId::quick_fix("typed-hole"),
|
||||
label: Label::new(format!("Replace `_` with `{code}`")),
|
||||
group: Some(GroupLabel("Replace `_` with a term".to_owned())),
|
||||
target: original_range.range,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use either::Either;
|
|||
use hir::{Adt, FileRange, HasSource, HirDisplay, InFile, Struct, Union, db::ExpandDatabase};
|
||||
use ide_db::text_edit::TextEdit;
|
||||
use ide_db::{
|
||||
assists::{Assist, AssistId, AssistKind},
|
||||
assists::{Assist, AssistId},
|
||||
helpers::is_editable_crate,
|
||||
label::Label,
|
||||
source_change::{SourceChange, SourceChangeBuilder},
|
||||
|
|
@ -122,7 +122,7 @@ fn add_variant_to_union(
|
|||
let mut src_change_builder = SourceChangeBuilder::new(range.file_id);
|
||||
src_change_builder.insert(offset, record_field);
|
||||
Some(Assist {
|
||||
id: AssistId("add-variant-to-union", AssistKind::QuickFix),
|
||||
id: AssistId::quick_fix("add-variant-to-union"),
|
||||
label: Label::new("Add field to union".to_owned()),
|
||||
group: None,
|
||||
target: error_range.range,
|
||||
|
|
@ -170,7 +170,7 @@ fn add_field_to_struct_fix(
|
|||
// FIXME: Allow for choosing a visibility modifier see https://github.com/rust-lang/rust-analyzer/issues/11563
|
||||
src_change_builder.insert(offset, record_field);
|
||||
Some(Assist {
|
||||
id: AssistId("add-field-to-record-struct", AssistKind::QuickFix),
|
||||
id: AssistId::quick_fix("add-field-to-record-struct"),
|
||||
label: Label::new("Add field to Record Struct".to_owned()),
|
||||
group: None,
|
||||
target: error_range.range,
|
||||
|
|
@ -206,7 +206,7 @@ fn add_field_to_struct_fix(
|
|||
src_change_builder.replace(semi_colon.text_range(), record_field_list.to_string());
|
||||
|
||||
Some(Assist {
|
||||
id: AssistId("convert-unit-struct-to-record-struct", AssistKind::QuickFix),
|
||||
id: AssistId::quick_fix("convert-unit-struct-to-record-struct"),
|
||||
label: Label::new("Convert Unit Struct to Record Struct and add field".to_owned()),
|
||||
group: None,
|
||||
target: error_range.range,
|
||||
|
|
@ -265,7 +265,7 @@ fn method_fix(
|
|||
let expr = expr_ptr.value.to_node(&root);
|
||||
let FileRange { range, file_id } = ctx.sema.original_range_opt(expr.syntax())?;
|
||||
Some(Assist {
|
||||
id: AssistId("expected-field-found-method-call-fix", AssistKind::QuickFix),
|
||||
id: AssistId::quick_fix("expected-field-found-method-call-fix"),
|
||||
label: Label::new("Use parentheses to call the method".to_owned()),
|
||||
group: None,
|
||||
target: range,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use hir::{FileRange, HirDisplay, InFile, db::ExpandDatabase};
|
||||
use ide_db::text_edit::TextEdit;
|
||||
use ide_db::{
|
||||
assists::{Assist, AssistId, AssistKind},
|
||||
assists::{Assist, AssistId},
|
||||
label::Label,
|
||||
source_change::SourceChange,
|
||||
};
|
||||
|
|
@ -96,7 +96,7 @@ fn field_fix(
|
|||
_ => return None,
|
||||
};
|
||||
Some(Assist {
|
||||
id: AssistId("expected-method-found-field-fix", AssistKind::QuickFix),
|
||||
id: AssistId::quick_fix("expected-method-found-field-fix"),
|
||||
label: Label::new("Use parentheses to call the value of the field".to_owned()),
|
||||
group: None,
|
||||
target: range,
|
||||
|
|
@ -175,7 +175,7 @@ fn assoc_func_fix(ctx: &DiagnosticsContext<'_>, d: &hir::UnresolvedMethodCall) -
|
|||
let file_id = ctx.sema.original_range_opt(call.receiver()?.syntax())?.file_id;
|
||||
|
||||
Some(Assist {
|
||||
id: AssistId("method_call_to_assoc_func_call_fix", AssistKind::QuickFix),
|
||||
id: AssistId::quick_fix("method_call_to_assoc_func_call_fix"),
|
||||
label: Label::new(format!(
|
||||
"Use associated func call instead: `{assoc_func_call_expr_string}`"
|
||||
)),
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use hir::Name;
|
|||
use ide_db::text_edit::TextEdit;
|
||||
use ide_db::{
|
||||
FileRange, RootDatabase,
|
||||
assists::{Assist, AssistId, AssistKind},
|
||||
assists::{Assist, AssistId},
|
||||
label::Label,
|
||||
source_change::SourceChange,
|
||||
};
|
||||
|
|
@ -68,7 +68,7 @@ fn fixes(
|
|||
}
|
||||
|
||||
Some(vec![Assist {
|
||||
id: AssistId("unscore_unused_variable_name", AssistKind::QuickFix),
|
||||
id: AssistId::quick_fix("unscore_unused_variable_name"),
|
||||
label: Label::new(format!(
|
||||
"Rename unused {} to _{}",
|
||||
var_name.display(db, edition),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue