impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
pub fn new(cx: &'a LateContext<'a, 'tcx>) -> Self {
- SpanlessEq {
+ Self {
cx: cx,
ignore_fn: false,
}
}
pub fn ignore_fn(self) -> Self {
- SpanlessEq {
+ Self {
cx: self.cx,
ignore_fn: true,
}
}
fn eq_path_parameters(&self, left: &PathParameters, right: &PathParameters) -> bool {
- match (left, right) {
- (&AngleBracketedParameters(ref left), &AngleBracketedParameters(ref right)) => {
- over(&left.lifetimes, &right.lifetimes, |l, r| self.eq_lifetime(l, r)) &&
- over(&left.types, &right.types, |l, r| self.eq_ty(l, r)) &&
- over(&left.bindings, &right.bindings, |l, r| self.eq_type_binding(l, r))
- },
- (&ParenthesizedParameters(ref left), &ParenthesizedParameters(ref right)) => {
- over(&left.inputs, &right.inputs, |l, r| self.eq_ty(l, r)) &&
- both(&left.output, &right.output, |l, r| self.eq_ty(l, r))
- },
- (&AngleBracketedParameters(_), &ParenthesizedParameters(_)) |
- (&ParenthesizedParameters(_), &AngleBracketedParameters(_)) => false,
+ if !(left.parenthesized || right.parenthesized) {
+ over(&left.lifetimes, &right.lifetimes, |l, r| self.eq_lifetime(l, r)) &&
+ over(&left.types, &right.types, |l, r| self.eq_ty(l, r)) &&
+ over(&left.bindings, &right.bindings, |l, r| self.eq_type_binding(l, r))
+ } else if left.parenthesized && right.parenthesized {
+ over(left.inputs(), right.inputs(), |l, r| self.eq_ty(l, r)) &&
+ both(
+ &Some(&left.bindings[0].ty),
+ &Some(&right.bindings[0].ty),
+ |l, r| self.eq_ty(l, r),
+ )
+ } else {
+ false
}
}
impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
pub fn new(cx: &'a LateContext<'a, 'tcx>) -> Self {
- SpanlessHash {
+ Self {
cx: cx,
s: DefaultHasher::new(),
}
self.hash_name(&i.node.name);
}
},
+ ExprYield(ref e) => {
+ let c: fn(_) -> _ = ExprYield;
+ c.hash(&mut self.s);
+ self.hash_expr(e);
+ },
ExprAssign(ref l, ref r) => {
let c: fn(_, _) -> _ = ExprAssign;
c.hash(&mut self.s);
self.hash_expr(e);
// TODO: _ty
},
- ExprClosure(cap, _, eid, _) => {
- let c: fn(_, _, _, _) -> _ = ExprClosure;
+ ExprClosure(cap, _, eid, _, _) => {
+ let c: fn(_, _, _, _, _) -> _ = ExprClosure;
c.hash(&mut self.s);
cap.hash(&mut self.s);
self.hash_expr(&self.cx.tcx.hir.body(eid).value);