@@ -12,17 +12,20 @@ use syntax::{ast, TokenText};
1212
1313use crate :: {
1414 completions:: Completions ,
15- context:: { CompletionContext , LifetimeContext } ,
15+ context:: { CompletionContext , LifetimeContext , LifetimeKind } ,
1616} ;
1717
1818/// Completes lifetimes.
1919pub ( crate ) fn complete_lifetime ( acc : & mut Completions , ctx : & CompletionContext ) {
20- let lp = match & ctx. lifetime_ctx {
21- Some ( LifetimeContext :: Lifetime ) => None ,
22- Some ( LifetimeContext :: LifetimeParam { is_decl : false , param } ) => Some ( param) ,
20+ let ( lp, lifetime) = match ctx. lifetime_ctx ( ) {
21+ Some ( LifetimeContext { kind : LifetimeKind :: Lifetime , lifetime } ) => ( None , lifetime) ,
22+ Some ( LifetimeContext {
23+ kind : LifetimeKind :: LifetimeParam { is_decl : false , param } ,
24+ lifetime,
25+ } ) => ( Some ( param) , lifetime) ,
2326 _ => return ,
2427 } ;
25- let param_lifetime = match ( ctx . lifetime ( ) , lp. and_then ( |lp| lp. lifetime ( ) ) ) {
28+ let param_lifetime = match ( lifetime, lp. and_then ( |lp| lp. lifetime ( ) ) ) {
2629 ( Some ( lt) , Some ( lp) ) if lp == lt. clone ( ) => return ,
2730 ( Some ( _) , Some ( lp) ) => Some ( lp) ,
2831 _ => None ,
@@ -46,7 +49,7 @@ pub(crate) fn complete_lifetime(acc: &mut Completions, ctx: &CompletionContext)
4649
4750/// Completes labels.
4851pub ( crate ) fn complete_label ( acc : & mut Completions , ctx : & CompletionContext ) {
49- if !matches ! ( ctx. lifetime_ctx, Some ( LifetimeContext :: LabelRef ) ) {
52+ if !matches ! ( ctx. lifetime_ctx( ) , Some ( LifetimeContext { kind : LifetimeKind :: LabelRef , .. } ) ) {
5053 return ;
5154 }
5255 ctx. process_all_names_raw ( & mut |name, res| {
0 commit comments