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 {
}
// 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(..))
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) => {
}
// 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(..))
}
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;
}