Skip to content

Commit

Permalink
Use UnhashMap
Browse files Browse the repository at this point in the history
  • Loading branch information
camsteffen committed May 24, 2021
1 parent f21d909 commit 24743b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion clippy_lints/src/trait_bounds.rs
Expand Up @@ -3,6 +3,7 @@ use clippy_utils::source::{snippet, snippet_with_applicability};
use clippy_utils::{in_macro, SpanlessHash};
use if_chain::if_chain;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::unhash::UnhashMap;
use rustc_errors::Applicability;
use rustc_hir::{def::Res, GenericBound, Generics, ParamName, Path, QPath, TyKind, WherePredicate};
use rustc_lint::{LateContext, LateLintPass};
Expand Down Expand Up @@ -100,7 +101,7 @@ impl TraitBounds {
hasher.hash_ty(ty);
hasher.finish()
};
let mut map = FxHashMap::default();
let mut map: UnhashMap<u64, Vec<&GenericBound<'_>>> = UnhashMap::default();
let mut applicability = Applicability::MaybeIncorrect;
for bound in gen.where_clause.predicates {
if_chain! {
Expand Down
6 changes: 3 additions & 3 deletions clippy_utils/src/lib.rs
Expand Up @@ -63,7 +63,7 @@ use std::hash::BuildHasherDefault;

use if_chain::if_chain;
use rustc_ast::ast::{self, Attribute, BorrowKind, LitKind};
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::unhash::UnhashMap;
use rustc_hir as hir;
use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::DefId;
Expand Down Expand Up @@ -1578,8 +1578,8 @@ where

let mut match_expr_list: Vec<(&T, &T)> = Vec::new();

let mut map: FxHashMap<_, Vec<&_>> =
FxHashMap::with_capacity_and_hasher(exprs.len(), BuildHasherDefault::default());
let mut map: UnhashMap<u64, Vec<&_>> =
UnhashMap::with_capacity_and_hasher(exprs.len(), BuildHasherDefault::default());

for expr in exprs {
match map.entry(hash(expr)) {
Expand Down

0 comments on commit 24743b3

Please sign in to comment.