X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Ftools%2Fclippy%2Fclippy_lints%2Fsrc%2Findex_refutable_slice.rs;h=2a4bcd773c684a508bcaff5c70c3405cf3ab9e47;hb=788f2969f6d2f7339c3c1e7da225d38283597804;hp=667652106987a6bff185c95d32c0334f2ed1c90e;hpb=8dddc8647731efb6d7f40b176bccdba5cebe46f2;p=rust.git diff --git a/src/tools/clippy/clippy_lints/src/index_refutable_slice.rs b/src/tools/clippy/clippy_lints/src/index_refutable_slice.rs index 66765210698..2a4bcd773c6 100644 --- a/src/tools/clippy/clippy_lints/src/index_refutable_slice.rs +++ b/src/tools/clippy/clippy_lints/src/index_refutable_slice.rs @@ -4,7 +4,7 @@ use clippy_utils::ty::is_copy; use clippy_utils::{is_expn_of, is_lint_allowed, meets_msrv, msrvs, path_to_local}; use if_chain::if_chain; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; use rustc_errors::Applicability; use rustc_hir as hir; use rustc_hir::intravisit::{self, Visitor}; @@ -92,9 +92,9 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) { extract_msrv_attr!(LateContext); } -fn find_slice_values(cx: &LateContext<'_>, pat: &hir::Pat<'_>) -> FxHashMap { +fn find_slice_values(cx: &LateContext<'_>, pat: &hir::Pat<'_>) -> FxIndexMap { let mut removed_pat: FxHashSet = FxHashSet::default(); - let mut slices: FxHashMap = FxHashMap::default(); + let mut slices: FxIndexMap = FxIndexMap::default(); pat.walk_always(|pat| { if let hir::PatKind::Binding(binding, value_hir_id, ident, sub_pat) = pat.kind { // We'll just ignore mut and ref mut for simplicity sake right now @@ -208,10 +208,10 @@ fn new(ident: Ident, needs_ref: bool) -> Self { fn filter_lintable_slices<'a, 'tcx>( cx: &'a LateContext<'tcx>, - slice_lint_info: FxHashMap, + slice_lint_info: FxIndexMap, max_suggested_slice: u64, scope: &'tcx hir::Expr<'tcx>, -) -> FxHashMap { +) -> FxIndexMap { let mut visitor = SliceIndexLintingVisitor { cx, slice_lint_info, @@ -225,7 +225,7 @@ fn filter_lintable_slices<'a, 'tcx>( struct SliceIndexLintingVisitor<'a, 'tcx> { cx: &'a LateContext<'tcx>, - slice_lint_info: FxHashMap, + slice_lint_info: FxIndexMap, max_suggested_slice: u64, }