about summary refs log tree commit diff
diff options
context:
space:
mode:
authorflip1995 <9744647+flip1995@users.noreply.github.com>2018-09-12 01:34:52 +0200
committerflip1995 <9744647+flip1995@users.noreply.github.com>2018-09-12 01:34:52 +0200
commite28440d2e0ee9bc8a5ed81f1c757b16656ad7739 (patch)
tree3f139dc46fee808f23aaed8782c9d9e54b8591fe
parentcfa3c33b1d9421076d4fc78e289f41eb743cf546 (diff)
downloadrust-e28440d2e0ee9bc8a5ed81f1c757b16656ad7739.tar.gz
rust-e28440d2e0ee9bc8a5ed81f1c757b16656ad7739.zip
Change Hash{Map, Set} to FxHash{Map, Set}
-rw-r--r--clippy_dev/src/lib.rs2
-rw-r--r--clippy_lints/src/copies.rs14
-rw-r--r--clippy_lints/src/functions.rs6
-rw-r--r--clippy_lints/src/inherent_impl.rs6
-rw-r--r--clippy_lints/src/len_zero.rs6
-rw-r--r--clippy_lints/src/lifetimes.rs10
-rw-r--r--clippy_lints/src/loops.rs30
-rw-r--r--clippy_lints/src/misc_early.rs4
-rw-r--r--clippy_lints/src/needless_pass_by_value.rs14
-rw-r--r--clippy_lints/src/regex.rs4
-rw-r--r--clippy_lints/src/types.rs2
-rw-r--r--clippy_lints/src/unused_label.rs6
-rw-r--r--clippy_lints/src/utils/author.rs6
-rw-r--r--clippy_lints/src/utils/internal_lints.rs14
-rw-r--r--clippy_lints/src/utils/usage.rs8
15 files changed, 67 insertions, 65 deletions
diff --git a/clippy_dev/src/lib.rs b/clippy_dev/src/lib.rs
index a872ecf3feb..f10ad81d130 100644
--- a/clippy_dev/src/lib.rs
+++ b/clippy_dev/src/lib.rs
@@ -1,3 +1,5 @@
+#![feature(tool_lints)]
+#![allow(clippy::default_hash_types)]
 extern crate regex;
 #[macro_use]
 extern crate lazy_static;
diff --git a/clippy_lints/src/copies.rs b/clippy_lints/src/copies.rs
index 8f1823be15a..01063d41ee8 100644
--- a/clippy_lints/src/copies.rs
+++ b/clippy_lints/src/copies.rs
@@ -2,8 +2,9 @@ use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
 use rustc::{declare_tool_lint, lint_array};
 use rustc::ty::Ty;
 use rustc::hir::*;
-use std::collections::HashMap;
+use rustc_data_structures::fx::FxHashMap;
 use std::collections::hash_map::Entry;
+use std::hash::BuildHasherDefault;
 use syntax::symbol::LocalInternedString;
 use rustc_data_structures::small_vec::OneVector;
 use crate::utils::{SpanlessEq, SpanlessHash};
@@ -263,8 +264,8 @@ fn if_sequence(mut expr: &Expr) -> (OneVector<&Expr>, OneVector<&Block>) {
 }
 
 /// Return the list of bindings in a pattern.
-fn bindings<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat) -> HashMap<LocalInternedString, Ty<'tcx>> {
-    fn bindings_impl<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat, map: &mut HashMap<LocalInternedString, Ty<'tcx>>) {
+fn bindings<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat) -> FxHashMap<LocalInternedString, Ty<'tcx>> {
+    fn bindings_impl<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat, map: &mut FxHashMap<LocalInternedString, Ty<'tcx>>) {
         match pat.node {
             PatKind::Box(ref pat) | PatKind::Ref(ref pat, _) => bindings_impl(cx, pat, map),
             PatKind::TupleStruct(_, ref pats, _) => for pat in pats {
@@ -299,7 +300,7 @@ fn bindings<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat) -> HashMap<LocalInt
         }
     }
 
-    let mut result = HashMap::new();
+    let mut result = FxHashMap::default();
     bindings_impl(cx, pat, &mut result);
     result
 }
@@ -333,7 +334,10 @@ where
         };
     }
 
-    let mut map: HashMap<_, Vec<&_>> = HashMap::with_capacity(exprs.len());
+    let mut map: FxHashMap<_, Vec<&_>> = FxHashMap::with_capacity_and_hasher(
+        exprs.len(),
+        BuildHasherDefault::default()
+    );
 
     for expr in exprs {
         match map.entry(hash(expr)) {
diff --git a/clippy_lints/src/functions.rs b/clippy_lints/src/functions.rs
index c170b0a1e15..ec9aa7a4fd3 100644
--- a/clippy_lints/src/functions.rs
+++ b/clippy_lints/src/functions.rs
@@ -5,7 +5,7 @@ use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
 use rustc::{declare_tool_lint, lint_array};
 use rustc::ty;
 use rustc::hir::def::Def;
-use std::collections::HashSet;
+use rustc_data_structures::fx::FxHashSet;
 use syntax::ast;
 use rustc_target::spec::abi::Abi;
 use syntax::source_map::Span;
@@ -151,7 +151,7 @@ impl<'a, 'tcx> Functions {
             let raw_ptrs = iter_input_pats(decl, body)
                 .zip(decl.inputs.iter())
                 .filter_map(|(arg, ty)| raw_ptr_arg(arg, ty))
-                .collect::<HashSet<_>>();
+                .collect::<FxHashSet<_>>();
 
             if !raw_ptrs.is_empty() {
                 let tables = cx.tcx.body_tables(body.id());
@@ -177,7 +177,7 @@ fn raw_ptr_arg(arg: &hir::Arg, ty: &hir::Ty) -> Option<ast::NodeId> {
 
 struct DerefVisitor<'a, 'tcx: 'a> {
     cx: &'a LateContext<'a, 'tcx>,
-    ptrs: HashSet<ast::NodeId>,
+    ptrs: FxHashSet<ast::NodeId>,
     tables: &'a ty::TypeckTables<'tcx>,
 }
 
diff --git a/clippy_lints/src/inherent_impl.rs b/clippy_lints/src/inherent_impl.rs
index 4ca812e56bd..a78811c31e5 100644
--- a/clippy_lints/src/inherent_impl.rs
+++ b/clippy_lints/src/inherent_impl.rs
@@ -3,7 +3,7 @@
 use rustc::hir::*;
 use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
 use rustc::{declare_tool_lint, lint_array};
-use std::collections::HashMap;
+use rustc_data_structures::fx::FxHashMap;
 use std::default::Default;
 use syntax_pos::Span;
 use crate::utils::span_lint_and_then;
@@ -41,12 +41,12 @@ declare_clippy_lint! {
 }
 
 pub struct Pass {
-    impls: HashMap<def_id::DefId, (Span, Generics)>,
+    impls: FxHashMap<def_id::DefId, (Span, Generics)>,
 }
 
 impl Default for Pass {
     fn default() -> Self {
-        Pass { impls: HashMap::new() }
+        Pass { impls: FxHashMap::default() }
     }
 }
 
diff --git a/clippy_lints/src/len_zero.rs b/clippy_lints/src/len_zero.rs
index 4c9c219828d..a31add18a94 100644
--- a/clippy_lints/src/len_zero.rs
+++ b/clippy_lints/src/len_zero.rs
@@ -3,7 +3,7 @@ use rustc::hir::*;
 use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
 use rustc::{declare_tool_lint, lint_array};
 use rustc::ty;
-use std::collections::HashSet;
+use rustc_data_structures::fx::FxHashSet;
 use syntax::ast::{Lit, LitKind, Name};
 use syntax::source_map::{Span, Spanned};
 use crate::utils::{get_item_name, in_macro, snippet, span_lint, span_lint_and_sugg, walk_ptrs_ty};
@@ -125,7 +125,7 @@ fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item, trait_items
     }
 
     // fill the set with current and super traits
-    fn fill_trait_set(traitt: DefId, set: &mut HashSet<DefId>, cx: &LateContext<'_, '_>) {
+    fn fill_trait_set(traitt: DefId, set: &mut FxHashSet<DefId>, cx: &LateContext<'_, '_>) {
         if set.insert(traitt) {
             for supertrait in ::rustc::traits::supertrait_def_ids(cx.tcx, traitt) {
                 fill_trait_set(supertrait, set, cx);
@@ -134,7 +134,7 @@ fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item, trait_items
     }
 
     if cx.access_levels.is_exported(visited_trait.id) && trait_items.iter().any(|i| is_named_self(cx, i, "len")) {
-        let mut current_and_super_traits = HashSet::new();
+        let mut current_and_super_traits = FxHashSet::default();
         let visited_trait_def_id = cx.tcx.hir.local_def_id(visited_trait.id);
         fill_trait_set(visited_trait_def_id, &mut current_and_super_traits, cx);
 
diff --git a/clippy_lints/src/lifetimes.rs b/clippy_lints/src/lifetimes.rs
index beec9bac940..5b04b829453 100644
--- a/clippy_lints/src/lifetimes.rs
+++ b/clippy_lints/src/lifetimes.rs
@@ -5,7 +5,7 @@ use rustc::{declare_tool_lint, lint_array};
 use rustc::hir::def::Def;
 use rustc::hir::*;
 use rustc::hir::intravisit::*;
-use std::collections::{HashMap, HashSet};
+use rustc_data_structures::fx::{FxHashMap, FxHashSet};
 use syntax::source_map::Span;
 use crate::utils::{last_path_segment, span_lint};
 use syntax::symbol::keywords;
@@ -237,8 +237,8 @@ fn could_use_elision<'a, 'tcx: 'a>(
     }
 }
 
-fn allowed_lts_from(named_generics: &[GenericParam]) -> HashSet<RefLt> {
-    let mut allowed_lts = HashSet::new();
+fn allowed_lts_from(named_generics: &[GenericParam]) -> FxHashSet<RefLt> {
+    let mut allowed_lts = FxHashSet::default();
     for par in named_generics.iter() {
         if let GenericParamKind::Lifetime { .. } = par.kind {
             if par.bounds.is_empty() {
@@ -263,7 +263,7 @@ fn lts_from_bounds<'a, T: Iterator<Item = &'a Lifetime>>(mut vec: Vec<RefLt>, bo
 
 /// Number of unique lifetimes in the given vector.
 fn unique_lifetimes(lts: &[RefLt]) -> usize {
-    lts.iter().collect::<HashSet<_>>().len()
+    lts.iter().collect::<FxHashSet<_>>().len()
 }
 
 /// A visitor usable for `rustc_front::visit::walk_ty()`.
@@ -424,7 +424,7 @@ fn has_where_lifetimes<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, where_clause: &
 }
 
 struct LifetimeChecker {
-    map: HashMap<Name, Span>,
+    map: FxHashMap<Name, Span>,
 }
 
 impl<'tcx> Visitor<'tcx> for LifetimeChecker {
diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs
index 6d9519911eb..7240819646f 100644
--- a/clippy_lints/src/loops.rs
+++ b/clippy_lints/src/loops.rs
@@ -15,7 +15,7 @@ use rustc::middle::mem_categorization::cmt_;
 use rustc::ty::{self, Ty};
 use rustc::ty::subst::Subst;
 use rustc_errors::Applicability;
-use std::collections::{HashMap, HashSet};
+use rustc_data_structures::fx::{FxHashMap, FxHashSet};
 use std::iter::{once, Iterator};
 use syntax::ast;
 use syntax::source_map::Span;
@@ -1030,10 +1030,10 @@ fn check_for_loop_range<'a, 'tcx>(
             let mut visitor = VarVisitor {
                 cx,
                 var: canonical_id,
-                indexed_mut: HashSet::new(),
-                indexed_indirectly: HashMap::new(),
-                indexed_directly: HashMap::new(),
-                referenced: HashSet::new(),
+                indexed_mut: FxHashSet::default(),
+                indexed_indirectly: FxHashMap::default(),
+                indexed_directly: FxHashMap::default(),
+                referenced: FxHashSet::default(),
                 nonindex: false,
                 prefer_mutable: false,
             };
@@ -1343,7 +1343,7 @@ fn check_for_loop_explicit_counter<'a, 'tcx>(
     // Look for variables that are incremented once per loop iteration.
     let mut visitor = IncrementVisitor {
         cx,
-        states: HashMap::new(),
+        states: FxHashMap::default(),
         depth: 0,
         done: false,
     };
@@ -1618,15 +1618,15 @@ struct VarVisitor<'a, 'tcx: 'a> {
     /// var name to look for as index
     var: ast::NodeId,
     /// indexed variables that are used mutably
-    indexed_mut: HashSet<Name>,
+    indexed_mut: FxHashSet<Name>,
     /// indirectly indexed variables (`v[(i + 4) % N]`), the extend is `None` for global
-    indexed_indirectly: HashMap<Name, Option<region::Scope>>,
+    indexed_indirectly: FxHashMap<Name, Option<region::Scope>>,
     /// subset of `indexed` of vars that are indexed directly: `v[i]`
     /// this will not contain cases like `v[calc_index(i)]` or `v[(i + 4) % N]`
-    indexed_directly: HashMap<Name, Option<region::Scope>>,
+    indexed_directly: FxHashMap<Name, Option<region::Scope>>,
     /// Any names that are used outside an index operation.
     /// Used to detect things like `&mut vec` used together with `vec[i]`
-    referenced: HashSet<Name>,
+    referenced: FxHashSet<Name>,
     /// has the loop variable been used in expressions other than the index of
     /// an index op?
     nonindex: bool,
@@ -1906,7 +1906,7 @@ enum VarState {
 /// Scan a for loop for variables that are incremented exactly once.
 struct IncrementVisitor<'a, 'tcx: 'a> {
     cx: &'a LateContext<'a, 'tcx>,     // context reference
-    states: HashMap<NodeId, VarState>, // incremented variables
+    states: FxHashMap<NodeId, VarState>, // incremented variables
     depth: u32,                        // depth of conditional expressions
     done: bool,
 }
@@ -2197,8 +2197,8 @@ fn check_infinite_loop<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, cond: &'tcx Expr, e
 
     let mut var_visitor = VarCollectorVisitor {
         cx,
-        ids: HashSet::new(),
-        def_ids: HashMap::new(),
+        ids: FxHashSet::default(),
+        def_ids: FxHashMap::default(),
         skip: false,
     };
     var_visitor.visit_expr(cond);
@@ -2228,8 +2228,8 @@ fn check_infinite_loop<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, cond: &'tcx Expr, e
 /// All variables definition IDs are collected
 struct VarCollectorVisitor<'a, 'tcx: 'a> {
     cx: &'a LateContext<'a, 'tcx>,
-    ids: HashSet<NodeId>,
-    def_ids: HashMap<def_id::DefId, bool>,
+    ids: FxHashSet<NodeId>,
+    def_ids: FxHashMap<def_id::DefId, bool>,
     skip: bool,
 }
 
diff --git a/clippy_lints/src/misc_early.rs b/clippy_lints/src/misc_early.rs
index c00b3d93c47..35a232f7f32 100644
--- a/clippy_lints/src/misc_early.rs
+++ b/clippy_lints/src/misc_early.rs
@@ -1,7 +1,7 @@
 use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, LintContext, in_external_macro};
 use rustc::{declare_tool_lint, lint_array};
+use rustc_data_structures::fx::FxHashMap;
 use if_chain::if_chain;
-use std::collections::HashMap;
 use std::char;
 use syntax::ast::*;
 use syntax::source_map::Span;
@@ -267,7 +267,7 @@ impl EarlyLintPass for MiscEarly {
     }
 
     fn check_fn(&mut self, cx: &EarlyContext<'_>, _: FnKind<'_>, decl: &FnDecl, _: Span, _: NodeId) {
-        let mut registered_names: HashMap<String, Span> = HashMap::new();
+        let mut registered_names: FxHashMap<String, Span> = FxHashMap::default();
 
         for arg in &decl.inputs {
             if let PatKind::Ident(_, ident, None) = arg.pat.node {
diff --git a/clippy_lints/src/needless_pass_by_value.rs b/clippy_lints/src/needless_pass_by_value.rs
index 340fa4d0ee0..76eaf0dba24 100644
--- a/clippy_lints/src/needless_pass_by_value.rs
+++ b/clippy_lints/src/needless_pass_by_value.rs
@@ -9,13 +9,13 @@ use rustc::traits;
 use rustc::middle::expr_use_visitor as euv;
 use rustc::middle::mem_categorization as mc;
 use rustc_target::spec::abi::Abi;
+use rustc_data_structures::fx::{FxHashMap, FxHashSet};
 use syntax::ast::NodeId;
 use syntax_pos::Span;
 use syntax::errors::DiagnosticBuilder;
 use crate::utils::{get_trait_def_id, implements_trait, in_macro, is_copy, is_self, match_type, multispan_sugg, paths,
             snippet, snippet_opt, span_lint_and_then};
 use crate::utils::ptr::get_spans;
-use std::collections::{HashMap, HashSet};
 use std::borrow::Cow;
 
 /// **What it does:** Checks for functions taking arguments by value, but not
@@ -301,18 +301,18 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
 
 struct MovedVariablesCtxt<'a, 'tcx: 'a> {
     cx: &'a LateContext<'a, 'tcx>,
-    moved_vars: HashSet<NodeId>,
+    moved_vars: FxHashSet<NodeId>,
     /// Spans which need to be prefixed with `*` for dereferencing the
     /// suggested additional reference.
-    spans_need_deref: HashMap<NodeId, HashSet<Span>>,
+    spans_need_deref: FxHashMap<NodeId, FxHashSet<Span>>,
 }
 
 impl<'a, 'tcx> MovedVariablesCtxt<'a, 'tcx> {
     fn new(cx: &'a LateContext<'a, 'tcx>) -> Self {
         Self {
             cx,
-            moved_vars: HashSet::new(),
-            spans_need_deref: HashMap::new(),
+            moved_vars: FxHashSet::default(),
+            spans_need_deref: FxHashMap::default(),
         }
     }
 
@@ -344,7 +344,7 @@ impl<'a, 'tcx> MovedVariablesCtxt<'a, 'tcx> {
                             if let ExprKind::Match(ref c, ..) = e.node {
                                 self.spans_need_deref
                                     .entry(vid)
-                                    .or_insert_with(HashSet::new)
+                                    .or_insert_with(FxHashSet::default)
                                     .insert(c.span);
                             }
                         },
@@ -357,7 +357,7 @@ impl<'a, 'tcx> MovedVariablesCtxt<'a, 'tcx> {
                                 then {
                                     self.spans_need_deref
                                         .entry(vid)
-                                        .or_insert_with(HashSet::new)
+                                        .or_insert_with(FxHashSet::default)
                                         .insert(local.init
                                             .as_ref()
                                             .map(|e| e.span)
diff --git a/clippy_lints/src/regex.rs b/clippy_lints/src/regex.rs
index 6ac40c5a1d2..b7409bfbc9f 100644
--- a/clippy_lints/src/regex.rs
+++ b/clippy_lints/src/regex.rs
@@ -2,8 +2,8 @@ use regex_syntax;
 use rustc::hir::*;
 use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
 use rustc::{declare_tool_lint, lint_array};
+use rustc_data_structures::fx::FxHashSet;
 use if_chain::if_chain;
-use std::collections::HashSet;
 use syntax::ast::{LitKind, NodeId, StrStyle};
 use syntax::source_map::{BytePos, Span};
 use crate::utils::{is_expn_of, match_def_path, match_type, opt_def_id, paths, span_help_and_lint, span_lint};
@@ -67,7 +67,7 @@ declare_clippy_lint! {
 
 #[derive(Clone, Default)]
 pub struct Pass {
-    spans: HashSet<Span>,
+    spans: FxHashSet<Span>,
     last: Option<NodeId>,
 }
 
diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs
index cc04eb8eece..c0369df504a 100644
--- a/clippy_lints/src/types.rs
+++ b/clippy_lints/src/types.rs
@@ -1,3 +1,5 @@
+#![allow(clippy::default_hash_types)]
+
 use crate::reexport::*;
 use rustc::hir;
 use rustc::hir::*;
diff --git a/clippy_lints/src/unused_label.rs b/clippy_lints/src/unused_label.rs
index 71d9520c05b..ababaad294d 100644
--- a/clippy_lints/src/unused_label.rs
+++ b/clippy_lints/src/unused_label.rs
@@ -2,7 +2,7 @@ use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
 use rustc::{declare_tool_lint, lint_array};
 use rustc::hir;
 use rustc::hir::intravisit::{walk_expr, walk_fn, FnKind, NestedVisitorMap, Visitor};
-use std::collections::HashMap;
+use rustc_data_structures::fx::FxHashMap;
 use syntax::ast;
 use syntax::source_map::Span;
 use syntax::symbol::LocalInternedString;
@@ -31,7 +31,7 @@ declare_clippy_lint! {
 pub struct UnusedLabel;
 
 struct UnusedLabelVisitor<'a, 'tcx: 'a> {
-    labels: HashMap<LocalInternedString, Span>,
+    labels: FxHashMap<LocalInternedString, Span>,
     cx: &'a LateContext<'a, 'tcx>,
 }
 
@@ -57,7 +57,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedLabel {
 
         let mut v = UnusedLabelVisitor {
             cx,
-            labels: HashMap::new(),
+            labels: FxHashMap::default(),
         };
         walk_fn(&mut v, kind, decl, body.id(), span, fn_id);
 
diff --git a/clippy_lints/src/utils/author.rs b/clippy_lints/src/utils/author.rs
index e2c809c0c7c..541d5353daf 100644
--- a/clippy_lints/src/utils/author.rs
+++ b/clippy_lints/src/utils/author.rs
@@ -8,8 +8,8 @@ use rustc::{declare_tool_lint, lint_array};
 use rustc::hir;
 use rustc::hir::{Expr, ExprKind, QPath, TyKind, Pat, PatKind, BindingAnnotation, StmtKind, DeclKind, Stmt};
 use rustc::hir::intravisit::{NestedVisitorMap, Visitor};
+use rustc_data_structures::fx::FxHashMap;
 use syntax::ast::{Attribute, LitKind, DUMMY_NODE_ID};
-use std::collections::HashMap;
 use crate::utils::get_attr;
 
 /// **What it does:** Generates clippy code that detects the offending pattern
@@ -154,7 +154,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
 impl PrintVisitor {
     fn new(s: &'static str) -> Self {
         Self {
-            ids: HashMap::new(),
+            ids: FxHashMap::default(),
             current: s.to_owned(),
         }
     }
@@ -186,7 +186,7 @@ impl PrintVisitor {
 struct PrintVisitor {
     /// Fields are the current index that needs to be appended to pattern
     /// binding names
-    ids: HashMap<&'static str, usize>,
+    ids: FxHashMap<&'static str, usize>,
     /// the name that needs to be destructured
     current: String,
 }
diff --git a/clippy_lints/src/utils/internal_lints.rs b/clippy_lints/src/utils/internal_lints.rs
index 7b2d2f15996..f3b915c7ce1 100644
--- a/clippy_lints/src/utils/internal_lints.rs
+++ b/clippy_lints/src/utils/internal_lints.rs
@@ -3,12 +3,11 @@ use rustc::{declare_tool_lint, lint_array};
 use rustc::hir::*;
 use rustc::hir;
 use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
-use rustc_data_structures::fx::FxHashMap;
+use rustc_data_structures::fx::{FxHashMap, FxHashSet};
 use crate::utils::{match_qpath, paths, span_lint, span_lint_and_sugg};
 use syntax::symbol::LocalInternedString;
 use syntax::ast::{Crate as AstCrate, Ident, ItemKind, Name};
 use syntax::source_map::Span;
-use std::collections::{HashMap, HashSet};
 
 
 /// **What it does:** Checks for various things we like to keep tidy in clippy.
@@ -114,12 +113,10 @@ impl EarlyLintPass for Clippy {
     }
 }
 
-
-
 #[derive(Clone, Debug, Default)]
 pub struct LintWithoutLintPass {
-    declared_lints: HashMap<Name, Span>,
-    registered_lints: HashSet<Name>,
+    declared_lints: FxHashMap<Name, Span>,
+    registered_lints: FxHashSet<Name>,
 }
 
 
@@ -129,7 +126,6 @@ impl LintPass for LintWithoutLintPass {
     }
 }
 
-
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LintWithoutLintPass {
     fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
         if let hir::ItemKind::Static(ref ty, MutImmutable, body_id) = item.node {
@@ -202,7 +198,7 @@ fn is_lint_array_type(ty: &Ty) -> bool {
 }
 
 struct LintCollector<'a, 'tcx: 'a> {
-    output: &'a mut HashSet<Name>,
+    output: &'a mut FxHashSet<Name>,
     cx: &'a LateContext<'a, 'tcx>,
 }
 
@@ -221,8 +217,6 @@ impl<'a, 'tcx: 'a> Visitor<'tcx> for LintCollector<'a, 'tcx> {
     }
 }
 
-
-
 pub struct DefaultHashTypes {
     map: FxHashMap<String, String>,
 }
diff --git a/clippy_lints/src/utils/usage.rs b/clippy_lints/src/utils/usage.rs
index 2661bc945f3..ac18d04e454 100644
--- a/clippy_lints/src/utils/usage.rs
+++ b/clippy_lints/src/utils/usage.rs
@@ -6,14 +6,14 @@ use rustc::middle::expr_use_visitor::*;
 use rustc::middle::mem_categorization::cmt_;
 use rustc::middle::mem_categorization::Categorization;
 use rustc::ty;
-use std::collections::HashSet;
+use rustc_data_structures::fx::FxHashSet;
 use syntax::ast::NodeId;
 use syntax::source_map::Span;
 
 /// Returns a set of mutated local variable ids or None if mutations could not be determined.
-pub fn mutated_variables<'a, 'tcx: 'a>(expr: &'tcx Expr, cx: &'a LateContext<'a, 'tcx>) -> Option<HashSet<NodeId>> {
+pub fn mutated_variables<'a, 'tcx: 'a>(expr: &'tcx Expr, cx: &'a LateContext<'a, 'tcx>) -> Option<FxHashSet<NodeId>> {
     let mut delegate = MutVarsDelegate {
-        used_mutably: HashSet::new(),
+        used_mutably: FxHashSet::default(),
         skip: false,
     };
     let def_id = def_id::DefId::local(expr.hir_id.owner);
@@ -39,7 +39,7 @@ pub fn is_potentially_mutated<'a, 'tcx: 'a>(
 }
 
 struct MutVarsDelegate {
-    used_mutably: HashSet<NodeId>,
+    used_mutably: FxHashSet<NodeId>,
     skip: bool,
 }