We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 7f45fed + 716673c commit 45f3da5Copy full SHA for 45f3da5
src/tools/rust-analyzer/crates/hir-def/src/body/pretty.rs
@@ -685,6 +685,7 @@ impl Printer<'_> {
685
self.print_binding(*id);
686
if let Some(pat) = subpat {
687
self.whitespace();
688
+ w!(self, "@ ");
689
self.print_pat(*pat);
690
}
691
src/tools/rust-analyzer/crates/hir-def/src/body/tests.rs
@@ -426,3 +426,21 @@ fn f() {
426
"should have a binding for `B`",
427
);
428
429
+
430
+#[test]
431
+fn regression_pretty_print_bind_pat() {
432
+ let (db, body, owner) = lower(
433
+ r#"
434
+fn foo() {
435
+ let v @ u = 123;
436
+}
437
+"#,
438
+ );
439
+ let printed = body.pretty_print(&db, owner, Edition::CURRENT);
440
+ assert_eq!(
441
+ printed,
442
+ r#"fn foo() -> () {
443
444
+}"#
445
446
0 commit comments