Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ljedrz committed Feb 24, 2019
1 parent 1fac380 commit 601cbc6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 21 deletions.
6 changes: 4 additions & 2 deletions clippy_lints/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions clippy_lints/src/needless_pass_by_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(..))
Expand Down
4 changes: 1 addition & 3 deletions clippy_lints/src/redundant_clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
6 changes: 4 additions & 2 deletions clippy_lints/src/trivially_copy_pass_by_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(..))
Expand Down
14 changes: 2 additions & 12 deletions clippy_lints/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 601cbc6

Please sign in to comment.