From 8bee2b88c075a2f007a7d5762727a840477c0893 Mon Sep 17 00:00:00 2001 From: Esteban Kuber Date: Wed, 17 Nov 2021 23:47:47 +0000 Subject: [PATCH] Remove some unnecessarily verbose code --- .../src/deriving/generic/mod.rs | 25 ++++--------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs index 0cdb86ea475c..58b6ef9f9f98 100644 --- a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs +++ b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs @@ -609,28 +609,13 @@ impl<'a> TraitDef<'a> { // and similarly for where clauses where_clause.predicates.extend(generics.where_clause.predicates.iter().map(|clause| { - match *clause { - ast::WherePredicate::BoundPredicate(ref wb) => { - ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate { - span: wb.span, - bound_generic_params: wb.bound_generic_params.clone(), - bounded_ty: wb.bounded_ty.clone(), - bounds: wb.bounds.to_vec(), - }) - } - ast::WherePredicate::RegionPredicate(ref rb) => { - ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate { - span: rb.span, - lifetime: rb.lifetime, - bounds: rb.bounds.to_vec(), - }) - } - ast::WherePredicate::EqPredicate(ref we) => { + match clause { + ast::WherePredicate::BoundPredicate(_) + | ast::WherePredicate::RegionPredicate(_) => clause.clone(), + ast::WherePredicate::EqPredicate(we) => { ast::WherePredicate::EqPredicate(ast::WhereEqPredicate { id: ast::DUMMY_NODE_ID, - span: we.span, - lhs_ty: we.lhs_ty.clone(), - rhs_ty: we.rhs_ty.clone(), + ..we.clone() }) } }