This commit is contained in:
Oliver Schneider 2017-04-28 13:00:42 +02:00
parent 52dec9d20b
commit b8d577d82d
11 changed files with 12 additions and 12 deletions

View File

@ -149,7 +149,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
if_let_chain!{[
parent_impl != ast::CRATE_NODE_ID,
let hir::map::Node::NodeItem(item) = cx.tcx.hir.get(parent_impl),
let hir::Item_::ItemImpl(_, _, _, Some(ref trait_ref), _, _) = item.node,
let hir::Item_::ItemImpl(_, _, _, _, Some(ref trait_ref), _, _) = item.node,
trait_ref.path.def.def_id() == trait_id
], { return; }}
implements_trait($cx, $ty, trait_id, &[$rty], None)

View File

@ -72,7 +72,7 @@ impl LintPass for Derive {
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Derive {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
if let ItemImpl(_, _, _, Some(ref trait_ref), _, _) = item.node {
if let ItemImpl(_, _, _, _, Some(ref trait_ref), _, _) = item.node {
let ty = cx.tcx.type_of(cx.tcx.hir.local_def_id(item.id));
let is_automatically_derived = is_automatically_derived(&*item.attrs);

View File

@ -81,7 +81,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
use rustc::hir::map::Node::*;
let is_impl = if let Some(NodeItem(item)) = cx.tcx.hir.find(cx.tcx.hir.get_parent_node(nodeid)) {
matches!(item.node, hir::ItemImpl(_, _, _, Some(_), _, _) | hir::ItemDefaultImpl(..))
matches!(item.node, hir::ItemImpl(_, _, _, _, Some(_), _, _) | hir::ItemDefaultImpl(..))
} else {
false
};

View File

@ -67,7 +67,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LenZero {
match item.node {
ItemTrait(_, _, _, ref trait_items) => check_trait_items(cx, item, trait_items),
ItemImpl(_, _, _, None, _, ref impl_items) => check_impl_items(cx, item, impl_items),
ItemImpl(_, _, _, _, None, _, ref impl_items) => check_impl_items(cx, item, impl_items),
_ => (),
}
}

View File

@ -642,7 +642,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
let hir::ImplItemKind::Method(ref sig, id) = implitem.node,
let Some(first_arg_ty) = sig.decl.inputs.get(0),
let Some(first_arg) = iter_input_pats(&sig.decl, cx.tcx.hir.body(id)).next(),
let hir::ItemImpl(_, _, _, None, ref self_ty, _) = item.node,
let hir::ItemImpl(_, _, _, _, None, ref self_ty, _) = item.node,
], {
// check missing trait implementations
for &(method_name, n_args, self_kind, out_type, trait_name) in &TRAIT_METHODS {

View File

@ -38,7 +38,7 @@ impl LintPass for Pass {
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
if_let_chain! {[
let ItemImpl(_, _, _, Some(ref trait_ref), _, ref impl_items) = item.node,
let ItemImpl(_, _, _, _, Some(ref trait_ref), _, ref impl_items) = item.node,
!is_automatically_derived(&*item.attrs),
let Some(eq_trait) = cx.tcx.lang_items.eq_trait(),
trait_ref.path.def.def_id() == eq_trait

View File

@ -141,7 +141,7 @@ fn is_in_debug_impl(cx: &LateContext, expr: &Expr) -> bool {
if let Some(NodeImplItem(item)) = map.find(map.get_parent(expr.id)) {
// `Debug` impl
if let Some(NodeItem(item)) = map.find(map.get_parent(item.id)) {
if let ItemImpl(_, _, _, Some(ref tr), _, _) = item.node {
if let ItemImpl(_, _, _, _, Some(ref tr), _, _) = item.node {
return match_path_old(&tr.path, &["Debug"]);
}
}

View File

@ -85,7 +85,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PointerPass {
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem) {
if let ImplItemKind::Method(ref sig, _) = item.node {
if let Some(NodeItem(it)) = cx.tcx.hir.find(cx.tcx.hir.get_parent(item.id)) {
if let ItemImpl(_, _, _, Some(_), _, _) = it.node {
if let ItemImpl(_, _, _, _, Some(_), _, _) = it.node {
return; // ignore trait impls
}
}

View File

@ -28,7 +28,7 @@ impl LintPass for Serde {
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Serde {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
if let ItemImpl(_, _, _, Some(ref trait_ref), _, ref items) = item.node {
if let ItemImpl(_, _, _, _, Some(ref trait_ref), _, ref items) = item.node {
let did = trait_ref.path.def.def_id();
if let Some(visit_did) = get_trait_def_id(cx, &paths::SERDE_DE_VISITOR) {
if did == visit_did {

View File

@ -74,7 +74,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypePass {
fn check_fn(&mut self, cx: &LateContext, _: FnKind, decl: &FnDecl, _: &Body, _: Span, id: NodeId) {
// skip trait implementations, see #605
if let Some(map::NodeItem(item)) = cx.tcx.hir.find(cx.tcx.hir.get_parent(id)) {
if let ItemImpl(_, _, _, Some(..), _, _) = item.node {
if let ItemImpl(_, _, _, _, Some(..), _, _) = item.node {
return;
}
}

View File

@ -396,10 +396,10 @@ fn print_item(cx: &LateContext, item: &hir::Item) {
hir::ItemDefaultImpl(_, ref _trait_ref) => {
println!("default impl");
},
hir::ItemImpl(_, _, _, Some(ref _trait_ref), _, _) => {
hir::ItemImpl(_, _, _, _, Some(ref _trait_ref), _, _) => {
println!("trait impl");
},
hir::ItemImpl(_, _, _, None, _, _) => {
hir::ItemImpl(_, _, _, _, None, _, _) => {
println!("impl");
},
}