From e5f709079a2f9c5227e10f5f4cd0371a2fd76ae3 Mon Sep 17 00:00:00 2001 From: Kevin Mehall Date: Mon, 27 Oct 2014 00:11:26 -0700 Subject: Preserve struct field pattern shorthand in the prettyprinter. Use the `is_shorthand` field introduced by #17813 (ead6c4b) to make the prettyprinter output the shorthand form. Fixes a few places that set `is_shorthand: true` when the pattern is not a PatIdent with the same name as the field. --- src/test/pretty/struct-pattern.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/test/pretty/struct-pattern.rs (limited to 'src/test/pretty/struct-pattern.rs') diff --git a/src/test/pretty/struct-pattern.rs b/src/test/pretty/struct-pattern.rs new file mode 100644 index 00000000000..b0795bb08f3 --- /dev/null +++ b/src/test/pretty/struct-pattern.rs @@ -0,0 +1,15 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// pp-exact +// pretty-compare-only +// Testing that shorthand struct patterns are preserved + +fn main() { let Foo { a, ref b, mut c, x: y, z: z } = foo; } -- cgit 1.4.1-3-g733a5