diff --git a/crates/ruff_linter/src/rules/pyflakes/rules/unused_import.rs b/crates/ruff_linter/src/rules/pyflakes/rules/unused_import.rs index 65254793d4..eff33fcb1c 100644 --- a/crates/ruff_linter/src/rules/pyflakes/rules/unused_import.rs +++ b/crates/ruff_linter/src/rules/pyflakes/rules/unused_import.rs @@ -2,7 +2,7 @@ use std::borrow::Cow; use std::iter; use anyhow::{anyhow, bail, Result}; -use rustc_hash::FxHashMap; +use std::collections::BTreeMap; use ruff_diagnostics::{Applicability, Diagnostic, Fix, FixAvailability, Violation}; use ruff_macros::{derive_message_formats, violation}; @@ -220,8 +220,8 @@ fn find_dunder_all_exprs<'a>(semantic: &'a SemanticModel) -> Vec<&'a ast::Expr> /// pub(crate) fn unused_import(checker: &Checker, scope: &Scope, diagnostics: &mut Vec) { // Collect all unused imports by statement. - let mut unused: FxHashMap<(NodeId, Exceptions), Vec> = FxHashMap::default(); - let mut ignored: FxHashMap<(NodeId, Exceptions), Vec> = FxHashMap::default(); + let mut unused: BTreeMap<(NodeId, Exceptions), Vec> = BTreeMap::default(); + let mut ignored: BTreeMap<(NodeId, Exceptions), Vec> = BTreeMap::default(); for binding_id in scope.binding_ids() { let binding = checker.semantic().binding(binding_id); diff --git a/crates/ruff_python_semantic/src/binding.rs b/crates/ruff_python_semantic/src/binding.rs index 67236682f9..22ee07490c 100644 --- a/crates/ruff_python_semantic/src/binding.rs +++ b/crates/ruff_python_semantic/src/binding.rs @@ -565,7 +565,7 @@ pub enum BindingKind<'a> { } bitflags! { - #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] + #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] pub struct Exceptions: u8 { const NAME_ERROR = 0b0000_0001; const MODULE_NOT_FOUND_ERROR = 0b0000_0010;