From af80c53450d723824bc532c65687da8dd68ece80 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Tue, 14 May 2019 10:03:16 +0200 Subject: [PATCH] Clippy dogfood --- clippy_lints/src/utils/higher.rs | 2 +- clippy_lints/src/utils/internal_lints.rs | 9 +++++---- clippy_lints/src/utils/mod.rs | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/clippy_lints/src/utils/higher.rs b/clippy_lints/src/utils/higher.rs index 88d08857eb6..370d319dc15 100644 --- a/clippy_lints/src/utils/higher.rs +++ b/clippy_lints/src/utils/higher.rs @@ -50,7 +50,7 @@ pub struct Range<'a> { pub fn range<'a, 'b, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'b hir::Expr) -> Option> { /// Finds the field named `name` in the field. Always return `Some` for /// convenience. - fn get_field<'a>(name: Symbol, fields: &'a [hir::Field]) -> Option<&'a hir::Expr> { + fn get_field(name: Symbol, fields: &[hir::Field]) -> Option<&hir::Expr> { let expr = &fields.iter().find(|field| field.ident.name == name)?.expr; Some(expr) diff --git a/clippy_lints/src/utils/internal_lints.rs b/clippy_lints/src/utils/internal_lints.rs index 08d29ec0dc7..275fd99fd5e 100644 --- a/clippy_lints/src/utils/internal_lints.rs +++ b/clippy_lints/src/utils/internal_lints.rs @@ -1,5 +1,4 @@ use crate::utils::{match_type, match_def_path, paths, span_help_and_lint, span_lint, walk_ptrs_ty}; -use crate::utils::sym; use if_chain::if_chain; use rustc::hir; use rustc::hir::def::{DefKind, Res}; @@ -8,9 +7,8 @@ use rustc::hir::*; use rustc::lint::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintArray, LintPass}; use rustc::{declare_lint_pass, declare_tool_lint, impl_lint_pass}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; -use syntax::ast::{Crate as AstCrate, ItemKind, Name}; +use syntax::ast::{Crate as AstCrate, Name}; use syntax::source_map::Span; -use syntax::symbol::LocalInternedString; declare_clippy_lint! { /// **What it does:** Checks for various things we like to keep tidy in clippy. @@ -76,7 +74,9 @@ declare_clippy_lint! { declare_lint_pass!(ClippyLintsInternal => [CLIPPY_LINTS_INTERNAL]); impl EarlyLintPass for ClippyLintsInternal { - fn check_crate(&mut self, cx: &EarlyContext<'_>, krate: &AstCrate) { + fn check_crate(&mut self, _cx: &EarlyContext<'_>, _krate: &AstCrate) { + /* + FIXME: turn back on when we get rid of all the lazy_statics if let Some(utils) = krate.module.items.iter().find(|item| item.ident.name == *sym::utils) { if let ItemKind::Mod(ref utils_mod) = utils.node { if let Some(paths) = utils_mod.items.iter().find(|item| item.ident.name == *sym::paths) { @@ -101,6 +101,7 @@ impl EarlyLintPass for ClippyLintsInternal { } } } + */ } } diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index 7673a415bf2..e08a83dd54c 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -1028,7 +1028,7 @@ pub fn has_iter_method(cx: &LateContext<'_, '_>, probably_ref_ty: Ty<'_>) -> Opt _ => return None, }; - for path in into_iter_collections.iter() { + for path in &into_iter_collections { if match_def_path(cx, def_id, path) { return Some(*path.last().unwrap()); }