@@ -3,7 +3,7 @@ use std::iter;
3
3
use hir:: AsAssocItem ;
4
4
use ide_db:: helpers:: {
5
5
import_assets:: { ImportCandidate , LocatedImport } ,
6
- item_name , mod_path_to_ast,
6
+ mod_path_to_ast,
7
7
} ;
8
8
use ide_db:: RootDatabase ;
9
9
use syntax:: {
@@ -78,7 +78,7 @@ pub(crate) fn qualify_path(acc: &mut Assists, ctx: &AssistContext) -> Option<()>
78
78
acc. add_group (
79
79
& group_label,
80
80
AssistId ( "qualify_path" , AssistKind :: QuickFix ) ,
81
- label ( ctx . db ( ) , candidate, & import) ,
81
+ label ( candidate, & import) ,
82
82
range,
83
83
|builder| {
84
84
qualify_candidate. qualify (
@@ -199,21 +199,17 @@ fn group_label(candidate: &ImportCandidate) -> GroupLabel {
199
199
GroupLabel ( format ! ( "Qualify {}" , name) )
200
200
}
201
201
202
- fn label ( db : & RootDatabase , candidate : & ImportCandidate , import : & LocatedImport ) -> String {
203
- let display_path = match item_name ( db, import. original_item ) {
204
- Some ( display_path) => display_path. to_string ( ) ,
205
- None => "{unknown}" . to_string ( ) ,
206
- } ;
202
+ fn label ( candidate : & ImportCandidate , import : & LocatedImport ) -> String {
207
203
match candidate {
208
204
ImportCandidate :: Path ( candidate) => {
209
205
if candidate. qualifier . is_some ( ) {
210
- format ! ( "Qualify with `{}`" , display_path )
206
+ format ! ( "Qualify with `{}`" , import . import_path )
211
207
} else {
212
- format ! ( "Qualify as `{}`" , display_path )
208
+ format ! ( "Qualify as `{}`" , import . import_path )
213
209
}
214
210
}
215
- ImportCandidate :: TraitAssocItem ( _) => format ! ( "Qualify `{}`" , display_path ) ,
216
- ImportCandidate :: TraitMethod ( _) => format ! ( "Qualify with cast as `{}`" , display_path ) ,
211
+ ImportCandidate :: TraitAssocItem ( _) => format ! ( "Qualify `{}`" , import . import_path ) ,
212
+ ImportCandidate :: TraitMethod ( _) => format ! ( "Qualify with cast as `{}`" , import . import_path ) ,
217
213
}
218
214
}
219
215
0 commit comments