diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-07-04 15:08:28 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-07-04 18:37:29 +1000 |
| commit | 2c911dc16f2ac3237fca7c7626982e6f6a4d0e33 (patch) | |
| tree | a0ebfd913ceff8b7b49795bdcd32724b160c87a6 /src | |
| parent | a7b1d31a9f358747221e8eb9986bb8303d5d6586 (diff) | |
| download | rust-2c911dc16f2ac3237fca7c7626982e6f6a4d0e33.tar.gz rust-2c911dc16f2ac3237fca7c7626982e6f6a4d0e33.zip | |
Avoid unnecessary 1-tuples in derived code.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/codegen/consts.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/deriving/deriving-all-codegen.stdout | 62 |
2 files changed, 32 insertions, 32 deletions
diff --git a/src/test/codegen/consts.rs b/src/test/codegen/consts.rs index c97223879ca..260d9de8670 100644 --- a/src/test/codegen/consts.rs +++ b/src/test/codegen/consts.rs @@ -10,7 +10,7 @@ // CHECK: @STATIC = {{.*}}, align 4 // This checks the constants from inline_enum_const -// CHECK: @alloc14 = {{.*}}, align 2 +// CHECK: @alloc12 = {{.*}}, align 2 // This checks the constants from {low,high}_align_const, they share the same // constant, but the alignment differs, so the higher one should be used diff --git a/src/test/ui/deriving/deriving-all-codegen.stdout b/src/test/ui/deriving/deriving-all-codegen.stdout index 7713627be5e..763b39a212a 100644 --- a/src/test/ui/deriving/deriving-all-codegen.stdout +++ b/src/test/ui/deriving/deriving-all-codegen.stdout @@ -554,8 +554,8 @@ enum Enum1 { impl ::core::clone::Clone for Enum1 { #[inline] fn clone(&self) -> Enum1 { - match (&*self,) { - (&Enum1::Single { x: ref __self_0 },) => + match &*self { + &Enum1::Single { x: ref __self_0 } => Enum1::Single { x: ::core::clone::Clone::clone(&*__self_0) }, } } @@ -564,8 +564,8 @@ impl ::core::clone::Clone for Enum1 { #[allow(unused_qualifications)] impl ::core::fmt::Debug for Enum1 { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match (&*self,) { - (&Enum1::Single { x: ref __self_0 },) => + match &*self { + &Enum1::Single { x: ref __self_0 } => ::core::fmt::Formatter::debug_struct_field1_finish(f, "Single", "x", &&*__self_0), } @@ -575,8 +575,8 @@ impl ::core::fmt::Debug for Enum1 { #[allow(unused_qualifications)] impl ::core::hash::Hash for Enum1 { fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - match (&*self,) { - (&Enum1::Single { x: ref __self_0 },) => { + match &*self { + &Enum1::Single { x: ref __self_0 } => { ::core::hash::Hash::hash(&*__self_0, state) } } @@ -669,10 +669,10 @@ impl ::core::marker::Copy for Fieldless { } #[allow(unused_qualifications)] impl ::core::fmt::Debug for Fieldless { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match (&*self,) { - (&Fieldless::A,) => ::core::fmt::Formatter::write_str(f, "A"), - (&Fieldless::B,) => ::core::fmt::Formatter::write_str(f, "B"), - (&Fieldless::C,) => ::core::fmt::Formatter::write_str(f, "C"), + match &*self { + &Fieldless::A => ::core::fmt::Formatter::write_str(f, "A"), + &Fieldless::B => ::core::fmt::Formatter::write_str(f, "B"), + &Fieldless::C => ::core::fmt::Formatter::write_str(f, "C"), } } } @@ -686,7 +686,7 @@ impl ::core::default::Default for Fieldless { #[allow(unused_qualifications)] impl ::core::hash::Hash for Fieldless { fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - match (&*self,) { + match &*self { _ => { ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self), state) @@ -775,13 +775,13 @@ impl ::core::marker::Copy for Mixed { } #[allow(unused_qualifications)] impl ::core::fmt::Debug for Mixed { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match (&*self,) { - (&Mixed::P,) => ::core::fmt::Formatter::write_str(f, "P"), - (&Mixed::Q,) => ::core::fmt::Formatter::write_str(f, "Q"), - (&Mixed::R(ref __self_0),) => + match &*self { + &Mixed::P => ::core::fmt::Formatter::write_str(f, "P"), + &Mixed::Q => ::core::fmt::Formatter::write_str(f, "Q"), + &Mixed::R(ref __self_0) => ::core::fmt::Formatter::debug_tuple_field1_finish(f, "R", &&*__self_0), - (&Mixed::S { d1: ref __self_0, d2: ref __self_1 },) => + &Mixed::S { d1: ref __self_0, d2: ref __self_1 } => ::core::fmt::Formatter::debug_struct_field2_finish(f, "S", "d1", &&*__self_0, "d2", &&*__self_1), } @@ -797,13 +797,13 @@ impl ::core::default::Default for Mixed { #[allow(unused_qualifications)] impl ::core::hash::Hash for Mixed { fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - match (&*self,) { - (&Mixed::R(ref __self_0),) => { + match &*self { + &Mixed::R(ref __self_0) => { ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self), state); ::core::hash::Hash::hash(&*__self_0, state) } - (&Mixed::S { d1: ref __self_0, d2: ref __self_1 },) => { + &Mixed::S { d1: ref __self_0, d2: ref __self_1 } => { ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self), state); ::core::hash::Hash::hash(&*__self_0, state); @@ -943,12 +943,12 @@ enum Fielded { X(u32), Y(bool), Z(Option<i32>), } impl ::core::clone::Clone for Fielded { #[inline] fn clone(&self) -> Fielded { - match (&*self,) { - (&Fielded::X(ref __self_0),) => + match &*self { + &Fielded::X(ref __self_0) => Fielded::X(::core::clone::Clone::clone(&*__self_0)), - (&Fielded::Y(ref __self_0),) => + &Fielded::Y(ref __self_0) => Fielded::Y(::core::clone::Clone::clone(&*__self_0)), - (&Fielded::Z(ref __self_0),) => + &Fielded::Z(ref __self_0) => Fielded::Z(::core::clone::Clone::clone(&*__self_0)), } } @@ -957,14 +957,14 @@ impl ::core::clone::Clone for Fielded { #[allow(unused_qualifications)] impl ::core::fmt::Debug for Fielded { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match (&*self,) { - (&Fielded::X(ref __self_0),) => + match &*self { + &Fielded::X(ref __self_0) => ::core::fmt::Formatter::debug_tuple_field1_finish(f, "X", &&*__self_0), - (&Fielded::Y(ref __self_0),) => + &Fielded::Y(ref __self_0) => ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Y", &&*__self_0), - (&Fielded::Z(ref __self_0),) => + &Fielded::Z(ref __self_0) => ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Z", &&*__self_0), } @@ -974,18 +974,18 @@ impl ::core::fmt::Debug for Fielded { #[allow(unused_qualifications)] impl ::core::hash::Hash for Fielded { fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - match (&*self,) { - (&Fielded::X(ref __self_0),) => { + match &*self { + &Fielded::X(ref __self_0) => { ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self), state); ::core::hash::Hash::hash(&*__self_0, state) } - (&Fielded::Y(ref __self_0),) => { + &Fielded::Y(ref __self_0) => { ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self), state); ::core::hash::Hash::hash(&*__self_0, state) } - (&Fielded::Z(ref __self_0),) => { + &Fielded::Z(ref __self_0) => { ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self), state); ::core::hash::Hash::hash(&*__self_0, state) |
