]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/trait_bounds.rs
Auto merge of #4809 - iankronquist:patch-1, r=flip1995
[rust.git] / clippy_lints / src / trait_bounds.rs
index 2ad2cb67830f3bf8c6c37e9687505a24064725a8..858b505712d31490c34d99ce42ac163d4afb2a2e 100644 (file)
@@ -1,9 +1,8 @@
-use crate::utils::{in_macro, snippet, span_help_and_lint, SpanlessHash};
-use rustc::hir::*;
-use rustc::impl_lint_pass;
-use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
+use crate::utils::{in_macro, snippet, span_lint_and_help, SpanlessHash};
 use rustc_data_structures::fx::FxHashMap;
-use rustc_session::declare_tool_lint;
+use rustc_hir::*;
+use rustc_lint::{LateContext, LateLintPass};
+use rustc_session::{declare_tool_lint, impl_lint_pass};
 
 #[derive(Copy, Clone)]
 pub struct TraitBounds;
@@ -32,7 +31,7 @@
 impl_lint_pass!(TraitBounds => [TYPE_REPETITION_IN_BOUNDS]);
 
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TraitBounds {
-    fn check_generics(&mut self, cx: &LateContext<'a, 'tcx>, gen: &'tcx Generics) {
+    fn check_generics(&mut self, cx: &LateContext<'a, 'tcx>, gen: &'tcx Generics<'_>) {
         if in_macro(gen.span) {
             return;
         }
@@ -42,7 +41,7 @@ fn check_generics(&mut self, cx: &LateContext<'a, 'tcx>, gen: &'tcx Generics) {
             hasher.finish()
         };
         let mut map = FxHashMap::default();
-        for bound in &gen.where_clause.predicates {
+        for bound in gen.where_clause.predicates {
             if let WherePredicate::BoundPredicate(ref p) = bound {
                 let h = hash(&p.bounded_ty);
                 if let Some(ref v) = map.insert(h, p.bounds.iter().collect::<Vec<_>>()) {
@@ -64,7 +63,7 @@ fn check_generics(&mut self, cx: &LateContext<'a, 'tcx>, gen: &'tcx Generics) {
                     }
                     hint_string.truncate(hint_string.len() - 2);
                     hint_string.push('`');
-                    span_help_and_lint(
+                    span_lint_and_help(
                         cx,
                         TYPE_REPETITION_IN_BOUNDS,
                         p.span,