mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Fix pretty-printing of @
patterns
It didn't print the `@`.
This commit is contained in:
parent
27e824fad4
commit
8c8e738636
2 changed files with 19 additions and 0 deletions
|
@ -685,6 +685,7 @@ impl Printer<'_> {
|
|||
self.print_binding(*id);
|
||||
if let Some(pat) = subpat {
|
||||
self.whitespace();
|
||||
w!(self, "@ ");
|
||||
self.print_pat(*pat);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -426,3 +426,21 @@ fn f() {
|
|||
"should have a binding for `B`",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn regression_pretty_print_bind_pat() {
|
||||
let (db, body, owner) = lower(
|
||||
r#"
|
||||
fn foo() {
|
||||
let v @ u = 123;
|
||||
}
|
||||
"#,
|
||||
);
|
||||
let printed = body.pretty_print(&db, owner, Edition::CURRENT);
|
||||
assert_eq!(
|
||||
printed,
|
||||
r#"fn foo() -> () {
|
||||
let v @ u = 123;
|
||||
}"#
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue