diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs index 886dde4b977..0ae0450cbe0 100644 --- a/clippy_utils/src/lib.rs +++ b/clippy_utils/src/lib.rs @@ -20,7 +20,6 @@ extern crate rustc_attr; extern crate rustc_data_structures; extern crate rustc_errors; extern crate rustc_hir; -extern crate rustc_hir_pretty; extern crate rustc_infer; extern crate rustc_lexer; extern crate rustc_lint; @@ -1333,7 +1332,7 @@ pub fn if_sequence<'tcx>(mut expr: &'tcx Expr<'tcx>) -> (Vec<&'tcx Expr<'tcx>>, } /// Checks if the given function kind is an async function. -pub fn is_async_fn(kind: FnKind) -> bool { +pub fn is_async_fn(kind: FnKind<'_>) -> bool { matches!(kind, FnKind::ItemFn(_, _, header, _) if header.asyncness == IsAsync::Async) } diff --git a/clippy_utils/src/ty.rs b/clippy_utils/src/ty.rs index e1f8aff3740..c36e215f184 100644 --- a/clippy_utils/src/ty.rs +++ b/clippy_utils/src/ty.rs @@ -2,9 +2,8 @@ #![allow(clippy::module_name_repetitions)] -use std::collections::HashMap; - use rustc_ast::ast::Mutability; +use rustc_data_structures::fx::FxHashMap; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_hir::{TyKind, Unsafety}; @@ -184,14 +183,14 @@ pub fn is_must_use_ty<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool { /// Checks if `Ty` is normalizable. This function is useful /// to avoid crashes on `layout_of`. pub fn is_normalizable<'tcx>(cx: &LateContext<'tcx>, param_env: ty::ParamEnv<'tcx>, ty: Ty<'tcx>) -> bool { - is_normalizable_helper(cx, param_env, ty, &mut HashMap::new()) + is_normalizable_helper(cx, param_env, ty, &mut FxHashMap::default()) } fn is_normalizable_helper<'tcx>( cx: &LateContext<'tcx>, param_env: ty::ParamEnv<'tcx>, ty: Ty<'tcx>, - cache: &mut HashMap, bool>, + cache: &mut FxHashMap, bool>, ) -> bool { if let Some(&cached_result) = cache.get(ty) { return cached_result;