+// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+
use crate::consts::{constant_simple, constant_context};
-use rustc::lint::LateContext;
-use rustc::hir::*;
-use rustc::ty::{TypeckTables};
+use crate::rustc::lint::LateContext;
+use crate::rustc::hir::*;
+use crate::rustc::ty::{TypeckTables};
use std::hash::{Hash, Hasher};
use std::collections::hash_map::DefaultHasher;
-use syntax::ast::Name;
-use syntax::ptr::P;
+use crate::syntax::ast::Name;
+use crate::syntax::ptr::P;
use crate::utils::differing_macro_contexts;
/// Type used to check whether two ast are the same. This is different from the
&& both(&left.expr, &right.expr, |l, r| self.eq_expr(l, r))
}
+ #[allow(clippy::similar_names)]
pub fn eq_expr(&mut self, left: &Expr, right: &Expr) -> bool {
if self.ignore_fn && differing_macro_contexts(left.span, right.span) {
return false;
}
}
+ #[allow(clippy::similar_names)]
fn eq_qpath(&mut self, left: &QPath, right: &QPath) -> bool {
match (left, right) {
(&QPath::Resolved(ref lty, ref lpath), &QPath::Resolved(ref rty, ref rpath)) => {
self.eq_ty_kind(&left.node, &right.node)
}
+ #[allow(clippy::similar_names)]
pub fn eq_ty_kind(&mut self, left: &TyKind, right: &TyKind) -> bool {
match (left, right) {
(&TyKind::Slice(ref l_vec), &TyKind::Slice(ref r_vec)) => self.eq_ty(l_vec, r_vec),
CaptureClause::CaptureByValue => 0,
CaptureClause::CaptureByRef => 1,
}.hash(&mut self.s);
- let value = &self.cx.tcx.hir.body(eid).value;
- self.hash_expr(value);
+ self.hash_expr(&self.cx.tcx.hir.body(eid).value);
},
ExprKind::Field(ref e, ref f) => {
let c: fn(_, _) -> _ = ExprKind::Field;
self.hash_expr(e);
let full_table = self.tables;
self.tables = self.cx.tcx.body_tables(l_id.body);
- let value = &self.cx.tcx.hir.body(l_id.body).value;
- self.hash_expr(value);
+ self.hash_expr(&self.cx.tcx.hir.body(l_id.body).value);
self.tables = full_table;
},
ExprKind::Ret(ref e) => {