@@ -31,9 +31,10 @@ pub(super) fn hints(
3131 let range = closure. syntax ( ) . first_token ( ) ?. prev_token ( ) ?. text_range ( ) ;
3232 let range = TextRange :: new ( range. end ( ) - TextSize :: from ( 1 ) , range. end ( ) ) ;
3333 acc. push ( InlayHint {
34+ needs_resolve : false ,
3435 range,
3536 kind : InlayKind :: ClosureCapture ,
36- label : InlayHintLabel :: simple ( "move" , None , None ) ,
37+ label : InlayHintLabel :: from ( "move" ) ,
3738 text_edit : None ,
3839 position : InlayHintPosition :: After ,
3940 pad_left : false ,
@@ -43,6 +44,7 @@ pub(super) fn hints(
4344 }
4445 } ;
4546 acc. push ( InlayHint {
47+ needs_resolve : false ,
4648 range : move_kw_range,
4749 kind : InlayKind :: ClosureCapture ,
4850 label : InlayHintLabel :: from ( "(" ) ,
@@ -59,23 +61,25 @@ pub(super) fn hints(
5961 // force cache the source file, otherwise sema lookup will potentially panic
6062 _ = sema. parse_or_expand ( source. file ( ) ) ;
6163
64+ let label = InlayHintLabel :: simple (
65+ format ! (
66+ "{}{}" ,
67+ match capture. kind( ) {
68+ hir:: CaptureKind :: SharedRef => "&" ,
69+ hir:: CaptureKind :: UniqueSharedRef => "&unique " ,
70+ hir:: CaptureKind :: MutableRef => "&mut " ,
71+ hir:: CaptureKind :: Move => "" ,
72+ } ,
73+ capture. display_place( sema. db)
74+ ) ,
75+ None ,
76+ source. name ( ) . and_then ( |name| name. syntax ( ) . original_file_range_opt ( sema. db ) ) ,
77+ ) ;
6278 acc. push ( InlayHint {
79+ needs_resolve : label. needs_resolve ( ) ,
6380 range : move_kw_range,
6481 kind : InlayKind :: ClosureCapture ,
65- label : InlayHintLabel :: simple (
66- format ! (
67- "{}{}" ,
68- match capture. kind( ) {
69- hir:: CaptureKind :: SharedRef => "&" ,
70- hir:: CaptureKind :: UniqueSharedRef => "&unique " ,
71- hir:: CaptureKind :: MutableRef => "&mut " ,
72- hir:: CaptureKind :: Move => "" ,
73- } ,
74- capture. display_place( sema. db)
75- ) ,
76- None ,
77- source. name ( ) . and_then ( |name| name. syntax ( ) . original_file_range_opt ( sema. db ) ) ,
78- ) ,
82+ label,
7983 text_edit : None ,
8084 position : InlayHintPosition :: After ,
8185 pad_left : false ,
@@ -84,9 +88,10 @@ pub(super) fn hints(
8488
8589 if idx != last {
8690 acc. push ( InlayHint {
91+ needs_resolve : false ,
8792 range : move_kw_range,
8893 kind : InlayKind :: ClosureCapture ,
89- label : InlayHintLabel :: simple ( ", " , None , None ) ,
94+ label : InlayHintLabel :: from ( ", " ) ,
9095 text_edit : None ,
9196 position : InlayHintPosition :: After ,
9297 pad_left : false ,
@@ -95,6 +100,7 @@ pub(super) fn hints(
95100 }
96101 }
97102 acc. push ( InlayHint {
103+ needs_resolve : false ,
98104 range : move_kw_range,
99105 kind : InlayKind :: ClosureCapture ,
100106 label : InlayHintLabel :: from ( ")" ) ,
0 commit comments