From 2b0d8a86a288a9d1b7724f6496eb2c555863eb86 Mon Sep 17 00:00:00 2001 From: Jake Heinz Date: Fri, 14 Jan 2022 09:25:45 +0000 Subject: [PATCH] fix warnings --- crates/ide/src/prime_caches.rs | 3 +-- crates/ide/src/prime_caches/topologic_sort.rs | 16 ++++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/crates/ide/src/prime_caches.rs b/crates/ide/src/prime_caches.rs index 6464d599f0..f5bf6de214 100644 --- a/crates/ide/src/prime_caches.rs +++ b/crates/ide/src/prime_caches.rs @@ -7,7 +7,7 @@ mod topologic_sort; use hir::db::DefDatabase; use ide_db::base_db::{ salsa::{Database, ParallelDatabase, Snapshot}, - Cancelled, CrateGraph, CrateId, SourceDatabase, SourceDatabaseExt, + CrateGraph, CrateId, SourceDatabase, SourceDatabaseExt, }; use rustc_hash::{FxHashMap, FxHashSet}; @@ -104,7 +104,6 @@ where let crates_total = crates_to_prime.len(); let mut crates_done = 0; - let mut crates_currently_indexing = FxHashMap::with_capacity_and_hasher(num_worker_threads as _, Default::default()); diff --git a/crates/ide/src/prime_caches/topologic_sort.rs b/crates/ide/src/prime_caches/topologic_sort.rs index f89f84bc5b..859c454283 100644 --- a/crates/ide/src/prime_caches/topologic_sort.rs +++ b/crates/ide/src/prime_caches/topologic_sort.rs @@ -2,7 +2,7 @@ use std::{collections::VecDeque, hash::Hash}; use rustc_hash::FxHashMap; -pub struct TopologicSortIterBuilder { +pub(crate) struct TopologicSortIterBuilder { nodes: FxHashMap>, } @@ -18,7 +18,7 @@ where self.nodes.entry(item).or_default() } - pub fn add(&mut self, item: T, predecessors: impl IntoIterator) { + pub(crate) fn add(&mut self, item: T, predecessors: impl IntoIterator) { let mut num_predecessors = 0; for predecessor in predecessors.into_iter() { @@ -30,7 +30,7 @@ where entry.num_predecessors += num_predecessors; } - pub fn build(self) -> TopologicalSortIter { + pub(crate) fn build(self) -> TopologicalSortIter { let ready = self .nodes .iter() @@ -43,7 +43,7 @@ where } } -pub struct TopologicalSortIter { +pub(crate) struct TopologicalSortIter { ready: VecDeque, nodes: FxHashMap>, } @@ -52,19 +52,19 @@ impl TopologicalSortIter where T: Copy + Eq + PartialEq + Hash, { - pub fn builder() -> TopologicSortIterBuilder { + pub(crate) fn builder() -> TopologicSortIterBuilder { TopologicSortIterBuilder::new() } - pub fn len(&self) -> usize { + pub(crate) fn len(&self) -> usize { self.nodes.len() } - pub fn is_empty(&self) -> bool { + pub(crate) fn is_empty(&self) -> bool { self.len() == 0 } - pub fn mark_done(&mut self, item: T) { + pub(crate) fn mark_done(&mut self, item: T) { let entry = self.nodes.remove(&item).expect("invariant: unknown item marked as done"); for successor in entry.successors {