@@ -31,9 +31,10 @@ pub(super) fn hints(
31
31
let range = closure. syntax ( ) . first_token ( ) ?. prev_token ( ) ?. text_range ( ) ;
32
32
let range = TextRange :: new ( range. end ( ) - TextSize :: from ( 1 ) , range. end ( ) ) ;
33
33
acc. push ( InlayHint {
34
+ needs_resolve : false ,
34
35
range,
35
36
kind : InlayKind :: ClosureCapture ,
36
- label : InlayHintLabel :: simple ( "move" , None , None ) ,
37
+ label : InlayHintLabel :: from ( "move" ) ,
37
38
text_edit : None ,
38
39
position : InlayHintPosition :: After ,
39
40
pad_left : false ,
@@ -43,6 +44,7 @@ pub(super) fn hints(
43
44
}
44
45
} ;
45
46
acc. push ( InlayHint {
47
+ needs_resolve : false ,
46
48
range : move_kw_range,
47
49
kind : InlayKind :: ClosureCapture ,
48
50
label : InlayHintLabel :: from ( "(" ) ,
@@ -59,23 +61,25 @@ pub(super) fn hints(
59
61
// force cache the source file, otherwise sema lookup will potentially panic
60
62
_ = sema. parse_or_expand ( source. file ( ) ) ;
61
63
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
+ ) ;
62
78
acc. push ( InlayHint {
79
+ needs_resolve : label. needs_resolve ( ) ,
63
80
range : move_kw_range,
64
81
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,
79
83
text_edit : None ,
80
84
position : InlayHintPosition :: After ,
81
85
pad_left : false ,
@@ -84,9 +88,10 @@ pub(super) fn hints(
84
88
85
89
if idx != last {
86
90
acc. push ( InlayHint {
91
+ needs_resolve : false ,
87
92
range : move_kw_range,
88
93
kind : InlayKind :: ClosureCapture ,
89
- label : InlayHintLabel :: simple ( ", " , None , None ) ,
94
+ label : InlayHintLabel :: from ( ", " ) ,
90
95
text_edit : None ,
91
96
position : InlayHintPosition :: After ,
92
97
pad_left : false ,
@@ -95,6 +100,7 @@ pub(super) fn hints(
95
100
}
96
101
}
97
102
acc. push ( InlayHint {
103
+ needs_resolve : false ,
98
104
range : move_kw_range,
99
105
kind : InlayKind :: ClosureCapture ,
100
106
label : InlayHintLabel :: from ( ")" ) ,
0 commit comments