fix formatting
This commit is contained in:
parent
1fac380886
commit
601cbc6d84
@ -114,8 +114,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
|
||||
span: Span,
|
||||
hir_id: hir::HirId,
|
||||
) {
|
||||
let is_impl = if let Some(hir::Node::Item(item)) = cx.tcx.hir().find_by_hir_id(
|
||||
cx.tcx.hir().get_parent_node_by_hir_id(hir_id))
|
||||
let is_impl = if let Some(hir::Node::Item(item)) = cx
|
||||
.tcx
|
||||
.hir()
|
||||
.find_by_hir_id(cx.tcx.hir().get_parent_node_by_hir_id(hir_id))
|
||||
{
|
||||
matches!(item.node, hir::ItemKind::Impl(_, _, _, _, Some(_), _, _))
|
||||
} else {
|
||||
|
@ -103,8 +103,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
|
||||
}
|
||||
|
||||
// Exclude non-inherent impls
|
||||
if let Some(Node::Item(item)) = cx.tcx.hir().find_by_hir_id(
|
||||
cx.tcx.hir().get_parent_node_by_hir_id(hir_id))
|
||||
if let Some(Node::Item(item)) = cx
|
||||
.tcx
|
||||
.hir()
|
||||
.find_by_hir_id(cx.tcx.hir().get_parent_node_by_hir_id(hir_id))
|
||||
{
|
||||
if matches!(item.node, ItemKind::Impl(_, _, _, _, Some(_), _, _) |
|
||||
ItemKind::Trait(..))
|
||||
|
@ -16,9 +16,7 @@ use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use std::convert::TryFrom;
|
||||
use syntax::{
|
||||
source_map::{BytePos, Span},
|
||||
};
|
||||
use syntax::source_map::{BytePos, Span};
|
||||
|
||||
macro_rules! unwrap_or_continue {
|
||||
($x:expr) => {
|
||||
|
@ -186,8 +186,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TriviallyCopyPassByRef {
|
||||
}
|
||||
|
||||
// Exclude non-inherent impls
|
||||
if let Some(Node::Item(item)) = cx.tcx.hir().find_by_hir_id(
|
||||
cx.tcx.hir().get_parent_node_by_hir_id(hir_id))
|
||||
if let Some(Node::Item(item)) = cx
|
||||
.tcx
|
||||
.hir()
|
||||
.find_by_hir_id(cx.tcx.hir().get_parent_node_by_hir_id(hir_id))
|
||||
{
|
||||
if matches!(item.node, ItemKind::Impl(_, _, _, _, Some(_), _, _) |
|
||||
ItemKind::Trait(..))
|
||||
|
@ -174,19 +174,9 @@ impl LintPass for TypePass {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypePass {
|
||||
fn check_fn(
|
||||
&mut self,
|
||||
cx: &LateContext<'_, '_>,
|
||||
_: FnKind<'_>,
|
||||
decl: &FnDecl,
|
||||
_: &Body,
|
||||
_: Span,
|
||||
id: HirId,
|
||||
) {
|
||||
fn check_fn(&mut self, cx: &LateContext<'_, '_>, _: FnKind<'_>, decl: &FnDecl, _: &Body, _: Span, id: HirId) {
|
||||
// skip trait implementations, see #605
|
||||
if let Some(hir::Node::Item(item)) = cx.tcx.hir().find_by_hir_id(
|
||||
cx.tcx.hir().get_parent_item(id))
|
||||
{
|
||||
if let Some(hir::Node::Item(item)) = cx.tcx.hir().find_by_hir_id(cx.tcx.hir().get_parent_item(id)) {
|
||||
if let ItemKind::Impl(_, _, _, _, Some(..), _, _) = item.node {
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user