mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-18 15:08:47 +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) {
|
if in_external_macro(cx.sess, expr.span) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if let ExprKind::Struct(_, ref fields, _) = expr.kind {
|
if let ExprKind::Struct(ref se) = expr.kind {
|
||||||
for field in fields {
|
for field in &se.fields {
|
||||||
if field.is_shorthand {
|
if field.is_shorthand {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,7 +564,7 @@ fn ident_difference_expr_with_base_location(
|
||||||
| (Try(_), Try(_))
|
| (Try(_), Try(_))
|
||||||
| (Paren(_), Paren(_))
|
| (Paren(_), Paren(_))
|
||||||
| (Repeat(_, _), Repeat(_, _))
|
| (Repeat(_, _), Repeat(_, _))
|
||||||
| (Struct(_, _, _), Struct(_, _, _))
|
| (Struct(_), Struct(_))
|
||||||
| (MacCall(_), MacCall(_))
|
| (MacCall(_), MacCall(_))
|
||||||
| (LlvmInlineAsm(_), LlvmInlineAsm(_))
|
| (LlvmInlineAsm(_), LlvmInlineAsm(_))
|
||||||
| (InlineAsm(_), InlineAsm(_))
|
| (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),
|
(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),
|
(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),
|
(MacCall(l), MacCall(r)) => eq_mac_call(l, r),
|
||||||
(Struct(lp, lfs, lb), Struct(rp, rfs, rb)) => {
|
(Struct(lse), Struct(rse)) => {
|
||||||
eq_path(lp, rp) && eq_struct_rest(lb, rb) && unordered_over(lfs, rfs, |l, r| eq_field(l, r))
|
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,
|
_ => false,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue