diff options
| author | DaniPopes <57450786+DaniPopes@users.noreply.github.com> | 2023-11-27 06:11:25 +0100 |
|---|---|---|
| committer | DaniPopes <57450786+DaniPopes@users.noreply.github.com> | 2023-11-27 06:11:25 +0100 |
| commit | 9ae3213fcb8ab78a4ffab7467225e138dac991de (patch) | |
| tree | f1adff23518ceafd0e93a1e1b560b440cb57c625 /library/core/src/tuple.rs | |
| parent | 48cfbe0cdfbc812a9bd8ce0b3bf6ca003bd12e6a (diff) | |
| download | rust-9ae3213fcb8ab78a4ffab7467225e138dac991de.tar.gz rust-9ae3213fcb8ab78a4ffab7467225e138dac991de.zip | |
Simplify Default for tuples
Diffstat (limited to 'library/core/src/tuple.rs')
| -rw-r--r-- | library/core/src/tuple.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/library/core/src/tuple.rs b/library/core/src/tuple.rs index ff292ff2dcb..765f73636fb 100644 --- a/library/core/src/tuple.rs +++ b/library/core/src/tuple.rs @@ -50,22 +50,19 @@ macro_rules! tuple_impls { maybe_tuple_doc! { $($T)+ @ #[unstable(feature = "structural_match", issue = "31434")] - impl<$($T: ConstParamTy),+> ConstParamTy for ($($T,)+) - {} + impl<$($T: ConstParamTy),+> ConstParamTy for ($($T,)+) {} } maybe_tuple_doc! { $($T)+ @ #[unstable(feature = "structural_match", issue = "31434")] - impl<$($T),+> StructuralPartialEq for ($($T,)+) - {} + impl<$($T),+> StructuralPartialEq for ($($T,)+) {} } maybe_tuple_doc! { $($T)+ @ #[unstable(feature = "structural_match", issue = "31434")] - impl<$($T),+> StructuralEq for ($($T,)+) - {} + impl<$($T),+> StructuralEq for ($($T,)+) {} } maybe_tuple_doc! { @@ -118,7 +115,7 @@ macro_rules! tuple_impls { impl<$($T: Default),+> Default for ($($T,)+) { #[inline] fn default() -> ($($T,)+) { - ($({ let x: $T = Default::default(); x},)+) + ($($T::default(),)+) } } } @@ -196,7 +193,7 @@ macro_rules! lexical_partial_cmp { ($a:expr, $b:expr, $($rest_a:expr, $rest_b:expr),+) => { match ($a).partial_cmp(&$b) { Some(Equal) => lexical_partial_cmp!($($rest_a, $rest_b),+), - ordering => ordering + ordering => ordering } }; ($a:expr, $b:expr) => { ($a).partial_cmp(&$b) }; @@ -206,7 +203,7 @@ macro_rules! lexical_cmp { ($a:expr, $b:expr, $($rest_a:expr, $rest_b:expr),+) => { match ($a).cmp(&$b) { Equal => lexical_cmp!($($rest_a, $rest_b),+), - ordering => ordering + ordering => ordering } }; ($a:expr, $b:expr) => { ($a).cmp(&$b) }; |
