@@ -118,12 +118,6 @@ impl<'a> RenderContext<'a> {
118
118
fn docs ( & self , node : impl HasAttrs ) -> Option < Documentation > {
119
119
node. docs ( self . db ( ) )
120
120
}
121
-
122
- // FIXME delete this method in favor of directly using the fields
123
- // on CompletionContext
124
- fn expected_name_and_type ( & self ) -> Option < ( String , Type ) > {
125
- Some ( ( self . completion . expected_name . clone ( ) ?, self . completion . expected_type . clone ( ) ?) )
126
- }
127
121
}
128
122
129
123
/// Generic renderer for completion items.
@@ -249,8 +243,8 @@ impl<'a> Render<'a> {
249
243
relevance. is_local = true ;
250
244
item. set_relevance ( relevance) ;
251
245
252
- if let Some ( ( _expected_name , expected_type) ) = self . ctx . expected_name_and_type ( ) {
253
- if ty != expected_type {
246
+ if let Some ( expected_type) = self . ctx . completion . expected_type . as_ref ( ) {
247
+ if & ty != expected_type {
254
248
if let Some ( ty_without_ref) = expected_type. remove_ref ( ) {
255
249
if relevance_type_match ( self . ctx . db ( ) . upcast ( ) , & ty, & ty_without_ref) {
256
250
cov_mark:: hit!( suggest_ref) ;
@@ -322,10 +316,8 @@ impl<'a> Render<'a> {
322
316
fn compute_relevance ( ctx : & RenderContext , ty : & Type , name : & str ) -> CompletionRelevance {
323
317
let mut res = CompletionRelevance :: default ( ) ;
324
318
325
- if let Some ( ( expected_name, expected_type) ) = ctx. expected_name_and_type ( ) {
326
- res. exact_type_match = ty == & expected_type;
327
- res. exact_name_match = name == & expected_name;
328
- }
319
+ res. exact_type_match = Some ( ty) == ctx. completion . expected_type . as_ref ( ) ;
320
+ res. exact_name_match = Some ( name) == ctx. completion . expected_name . as_deref ( ) ;
329
321
330
322
res
331
323
}
0 commit comments