This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +27
-2
lines changed
src/tools/rust-analyzer/crates/ide/src/inlay_hints Expand file tree Collapse file tree 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(
106106 InlayHintPosition :: Before => h. range . start ( ) ,
107107 InlayHintPosition :: After => h. range . end ( ) ,
108108 } ,
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 ( ) ,
110110 ) ;
111111 }
112112 let edit = edit. finish ( ) ;
@@ -118,8 +118,10 @@ pub(super) fn hints(
118118
119119#[ cfg( test) ]
120120mod tests {
121+ use expect_test:: expect;
122+
121123 use crate :: {
122- inlay_hints:: tests:: { check_with_config, DISABLED_CONFIG } ,
124+ inlay_hints:: tests:: { check_edit , check_with_config, DISABLED_CONFIG } ,
123125 InlayHintsConfig ,
124126 } ;
125127
@@ -194,4 +196,27 @@ fn foo(s @ Struct { field, .. }: &Struct) {}
194196"# ,
195197 ) ;
196198 }
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+ }
197222}
You can’t perform that action at this time.
0 commit comments