This commit is contained in:
Manish Goregaokar 2019-06-25 14:41:10 -07:00
parent 4a6914bb8c
commit e3619a6507
3 changed files with 3 additions and 15 deletions

View File

@ -107,11 +107,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
span: Span, span: Span,
hir_id: hir::HirId, hir_id: hir::HirId,
) { ) {
let is_impl = if let Some(hir::Node::Item(item)) = cx let is_impl = if let Some(hir::Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_node(hir_id)) {
.tcx
.hir()
.find(cx.tcx.hir().get_parent_node(hir_id))
{
matches!(item.node, hir::ItemKind::Impl(_, _, _, _, Some(_), _, _)) matches!(item.node, hir::ItemKind::Impl(_, _, _, _, Some(_), _, _))
} else { } else {
false false

View File

@ -88,11 +88,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
} }
// Exclude non-inherent impls // Exclude non-inherent impls
if let Some(Node::Item(item)) = cx if let Some(Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_node(hir_id)) {
.tcx
.hir()
.find(cx.tcx.hir().get_parent_node(hir_id))
{
if matches!(item.node, ItemKind::Impl(_, _, _, _, Some(_), _, _) | if matches!(item.node, ItemKind::Impl(_, _, _, _, Some(_), _, _) |
ItemKind::Trait(..)) ItemKind::Trait(..))
{ {

View File

@ -179,11 +179,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TriviallyCopyPassByRef {
} }
// Exclude non-inherent impls // Exclude non-inherent impls
if let Some(Node::Item(item)) = cx if let Some(Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_node(hir_id)) {
.tcx
.hir()
.find(cx.tcx.hir().get_parent_node(hir_id))
{
if matches!(item.node, ItemKind::Impl(_, _, _, _, Some(_), _, _) | if matches!(item.node, ItemKind::Impl(_, _, _, _, Some(_), _, _) |
ItemKind::Trait(..)) ItemKind::Trait(..))
{ {