Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F401 use BTreeMap instead of FxHashMap #11621

Merged
merged 2 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/ruff_linter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ typed-arena = { workspace = true }
unicode-width = { workspace = true }
unicode_names2 = { workspace = true }
url = { workspace = true }
indexmap.workspace = true

[dev-dependencies]
insta = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions crates/ruff_linter/src/rules/pyflakes/rules/unused_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::borrow::Cow;
use std::iter;

use anyhow::{anyhow, bail, Result};
use rustc_hash::FxHashMap;
use indexmap::map::IndexMap;

use ruff_diagnostics::{Applicability, Diagnostic, Fix, FixAvailability, Violation};
use ruff_macros::{derive_message_formats, violation};
Expand Down Expand Up @@ -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<Diagnostic>) {
// Collect all unused imports by statement.
let mut unused: FxHashMap<(NodeId, Exceptions), Vec<ImportBinding>> = FxHashMap::default();
let mut ignored: FxHashMap<(NodeId, Exceptions), Vec<ImportBinding>> = FxHashMap::default();
let mut unused: IndexMap<(NodeId, Exceptions), Vec<ImportBinding>> = IndexMap::default();
let mut ignored: IndexMap<(NodeId, Exceptions), Vec<ImportBinding>> = IndexMap::default();
plredmond marked this conversation as resolved.
Show resolved Hide resolved

for binding_id in scope.binding_ids() {
let binding = checker.semantic().binding(binding_id);
Expand Down
Loading