Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-diagnostics/src/handlers/trait_impl_redundant_assoc_item.rs')
| -rw-r--r-- | crates/ide-diagnostics/src/handlers/trait_impl_redundant_assoc_item.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/crates/ide-diagnostics/src/handlers/trait_impl_redundant_assoc_item.rs b/crates/ide-diagnostics/src/handlers/trait_impl_redundant_assoc_item.rs index 3db2e013a3..d5c4bcf768 100644 --- a/crates/ide-diagnostics/src/handlers/trait_impl_redundant_assoc_item.rs +++ b/crates/ide-diagnostics/src/handlers/trait_impl_redundant_assoc_item.rs @@ -1,7 +1,7 @@ -use hir::{db::ExpandDatabase, HasSource, HirDisplay}; +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, }; @@ -54,10 +54,12 @@ pub(crate) fn trait_impl_redundant_assoc_item( } }; + let hir::FileRange { file_id, range } = + hir::InFile::new(d.file_id, diagnostic_range).original_node_file_range_rooted(db); Diagnostic::new( DiagnosticCode::RustcHardError("E0407"), format!("{redundant_item_name} is not a member of trait `{trait_name}`"), - hir::InFile::new(d.file_id, diagnostic_range).original_node_file_range_rooted(db), + ide_db::FileRange { file_id: file_id.file_id(ctx.sema.db), range }, ) .with_fixes(quickfix_for_redundant_assoc_item( ctx, @@ -93,11 +95,11 @@ fn quickfix_for_redundant_assoc_item( Some(()) }; let file_id = d.file_id.file_id()?; - let mut source_change_builder = SourceChangeBuilder::new(file_id); + let mut source_change_builder = SourceChangeBuilder::new(file_id.file_id(ctx.sema.db)); 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, |