File tree 1 file changed +27
-2
lines changed
crates/ide/src/inlay_hints
1 file changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ pub(super) fn hints(
106
106
InlayHintPosition :: Before => h. range . start ( ) ,
107
107
InlayHintPosition :: After => h. range . end ( ) ,
108
108
} ,
109
- h. label . parts . iter ( ) . map ( |p| & * p. text ) . collect ( ) ,
109
+ h. label . parts . iter ( ) . map ( |p| & * p. text ) . chain ( h . pad_right . then_some ( " " ) ) . collect ( ) ,
110
110
) ;
111
111
}
112
112
let edit = edit. finish ( ) ;
@@ -118,8 +118,10 @@ pub(super) fn hints(
118
118
119
119
#[ cfg( test) ]
120
120
mod tests {
121
+ use expect_test:: expect;
122
+
121
123
use crate :: {
122
- inlay_hints:: tests:: { check_with_config, DISABLED_CONFIG } ,
124
+ inlay_hints:: tests:: { check_edit , check_with_config, DISABLED_CONFIG } ,
123
125
InlayHintsConfig ,
124
126
} ;
125
127
@@ -194,4 +196,27 @@ fn foo(s @ Struct { field, .. }: &Struct) {}
194
196
"# ,
195
197
) ;
196
198
}
199
+
200
+ #[ test]
201
+ fn edits ( ) {
202
+ check_edit (
203
+ InlayHintsConfig { binding_mode_hints : true , ..DISABLED_CONFIG } ,
204
+ r#"
205
+ fn main() {
206
+ match &(0,) {
207
+ (x,) | (x,) => (),
208
+ ((x,) | (x,)) => (),
209
+ }
210
+ }
211
+ "# ,
212
+ expect ! [ [ r#"
213
+ fn main() {
214
+ match &(0,) {
215
+ &(&((ref x,) | (ref x,))) => (),
216
+ &((ref x,) | (ref x,)) => (),
217
+ }
218
+ }
219
+ "# ] ] ,
220
+ ) ;
221
+ }
197
222
}
You can’t perform that action at this time.
0 commit comments