Skip to content

Commit

Permalink
Simplify Default for tuples
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Nov 27, 2023
1 parent 48cfbe0 commit 9ae3213
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions library/core/src/tuple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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! {
Expand Down Expand Up @@ -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(),)+)
}
}
}
Expand Down Expand Up @@ -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) };
Expand All @@ -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) };
Expand Down

0 comments on commit 9ae3213

Please sign in to comment.