fix formatting

This commit is contained in:
ljedrz 2019-02-24 15:16:16 +01:00
parent 1fac380886
commit 601cbc6d84
5 changed files with 15 additions and 21 deletions

View File

@ -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 {

View File

@ -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(..))

View File

@ -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) => {

View File

@ -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(..))

View File

@ -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;
}