mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
ast: Reduce size of ExprKind
by boxing fields of ExprKind::Struct
This commit is contained in:
parent
35e8be7407
commit
e72d28352c
3 changed files with 7 additions and 5 deletions
|
@ -58,8 +58,8 @@ impl EarlyLintPass for RedundantFieldNames {
|
|||
if in_external_macro(cx.sess, expr.span) {
|
||||
return;
|
||||
}
|
||||
if let ExprKind::Struct(_, ref fields, _) = expr.kind {
|
||||
for field in fields {
|
||||
if let ExprKind::Struct(ref se) = expr.kind {
|
||||
for field in &se.fields {
|
||||
if field.is_shorthand {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -564,7 +564,7 @@ fn ident_difference_expr_with_base_location(
|
|||
| (Try(_), Try(_))
|
||||
| (Paren(_), Paren(_))
|
||||
| (Repeat(_, _), Repeat(_, _))
|
||||
| (Struct(_, _, _), Struct(_, _, _))
|
||||
| (Struct(_), Struct(_))
|
||||
| (MacCall(_), MacCall(_))
|
||||
| (LlvmInlineAsm(_), LlvmInlineAsm(_))
|
||||
| (InlineAsm(_), InlineAsm(_))
|
||||
|
|
|
@ -168,8 +168,10 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
|
|||
(AddrOf(lbk, lm, le), AddrOf(rbk, rm, re)) => lbk == rbk && lm == rm && eq_expr(le, re),
|
||||
(Path(lq, lp), Path(rq, rp)) => both(lq, rq, |l, r| eq_qself(l, r)) && eq_path(lp, rp),
|
||||
(MacCall(l), MacCall(r)) => eq_mac_call(l, r),
|
||||
(Struct(lp, lfs, lb), Struct(rp, rfs, rb)) => {
|
||||
eq_path(lp, rp) && eq_struct_rest(lb, rb) && unordered_over(lfs, rfs, |l, r| eq_field(l, r))
|
||||
(Struct(lse), Struct(rse)) => {
|
||||
eq_path(&lse.path, &rse.path) &&
|
||||
eq_struct_rest(&lse.rest, &rse.rest) &&
|
||||
unordered_over(&lse.fields, &rse.fields, |l, r| eq_field(l, r))
|
||||
},
|
||||
_ => false,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue