From a2be847e1a915fe9711e533fce04d2ff1fa0204e Mon Sep 17 00:00:00 2001 From: XFFXFF <1247714429@qq.com> Date: Sat, 24 Sep 2022 00:20:03 +0000 Subject: [PATCH] remove unused variables and functions --- components/salsa-2022/src/function/execute.rs | 2 +- components/salsa-2022/src/runtime.rs | 4 ---- components/salsa-2022/src/runtime/active_query.rs | 4 ++-- components/salsa-2022/src/runtime/local_state.rs | 5 ++--- components/salsa-2022/src/runtime/shared_state.rs | 8 ++------ 5 files changed, 7 insertions(+), 16 deletions(-) diff --git a/components/salsa-2022/src/function/execute.rs b/components/salsa-2022/src/function/execute.rs index c05ad328..6857e579 100644 --- a/components/salsa-2022/src/function/execute.rs +++ b/components/salsa-2022/src/function/execute.rs @@ -71,7 +71,7 @@ where } } }; - let mut revisions = active_query.pop(runtime); + let mut revisions = active_query.pop(); // We assume that query is side-effect free -- that is, does // not mutate the "inputs" to the query system. Sanity check diff --git a/components/salsa-2022/src/runtime.rs b/components/salsa-2022/src/runtime.rs index 710ec67a..9bc7f12b 100644 --- a/components/salsa-2022/src/runtime.rs +++ b/components/salsa-2022/src/runtime.rs @@ -97,10 +97,6 @@ impl Runtime { self.local_state.active_query() } - pub(crate) fn empty_dependencies(&self) -> Arc<[DependencyIndex]> { - self.shared_state.empty_dependencies.clone() - } - pub fn snapshot(&self) -> Self { if self.local_state.query_in_progress() { panic!("it is not legal to `snapshot` during a query (see salsa-rs/salsa#80)"); diff --git a/components/salsa-2022/src/runtime/active_query.rs b/components/salsa-2022/src/runtime/active_query.rs index cf972d39..a97bf62f 100644 --- a/components/salsa-2022/src/runtime/active_query.rs +++ b/components/salsa-2022/src/runtime/active_query.rs @@ -3,7 +3,7 @@ use crate::{ hash::{FxIndexMap, FxIndexSet}, key::{DatabaseKeyIndex, DependencyIndex}, tracked_struct::Disambiguator, - Cycle, Revision, Runtime, + Cycle, Revision, }; use super::local_state::{EdgeKind, QueryEdges, QueryOrigin, QueryRevisions}; @@ -87,7 +87,7 @@ impl ActiveQuery { self.input_outputs.contains(&(EdgeKind::Output, key)) } - pub(crate) fn revisions(&self, runtime: &Runtime) -> QueryRevisions { + pub(crate) fn revisions(&self) -> QueryRevisions { let input_outputs = self.input_outputs.iter().copied().collect(); let edges = QueryEdges::new(input_outputs); diff --git a/components/salsa-2022/src/runtime/local_state.rs b/components/salsa-2022/src/runtime/local_state.rs index 3c8cb008..3d0bb3c5 100644 --- a/components/salsa-2022/src/runtime/local_state.rs +++ b/components/salsa-2022/src/runtime/local_state.rs @@ -6,7 +6,6 @@ use crate::key::DependencyIndex; use crate::runtime::Revision; use crate::tracked_struct::Disambiguator; use crate::Cycle; -use crate::Runtime; use std::cell::RefCell; use std::sync::Arc; @@ -339,14 +338,14 @@ impl ActiveQueryGuard<'_> { /// which summarizes the other queries that were accessed during this /// query's execution. #[inline] - pub(crate) fn pop(self, runtime: &Runtime) -> QueryRevisions { + pub(crate) fn pop(self) -> QueryRevisions { // Extract accumulated inputs. let popped_query = self.complete(); // If this frame were a cycle participant, it would have unwound. assert!(popped_query.cycle.is_none()); - popped_query.revisions(runtime) + popped_query.revisions() } /// If the active query is registered as a cycle participant, remove and diff --git a/components/salsa-2022/src/runtime/shared_state.rs b/components/salsa-2022/src/runtime/shared_state.rs index f7971150..14149001 100644 --- a/components/salsa-2022/src/runtime/shared_state.rs +++ b/components/salsa-2022/src/runtime/shared_state.rs @@ -1,9 +1,9 @@ -use std::sync::{atomic::AtomicUsize, Arc}; +use std::sync::atomic::AtomicUsize; use crossbeam::atomic::AtomicCell; use parking_lot::Mutex; -use crate::{durability::Durability, key::DependencyIndex, revision::AtomicRevision}; +use crate::{durability::Durability, revision::AtomicRevision}; use super::dependency_graph::DependencyGraph; @@ -13,9 +13,6 @@ pub(super) struct SharedState { /// Stores the next id to use for a snapshotted runtime (starts at 1). pub(super) next_id: AtomicUsize, - /// Vector we can clone - pub(super) empty_dependencies: Arc<[DependencyIndex]>, - /// Set to true when the current revision has been canceled. /// This is done when we an input is being changed. The flag /// is set back to false once the input has been changed. @@ -47,7 +44,6 @@ impl SharedState { fn with_durabilities(durabilities: usize) -> Self { SharedState { next_id: AtomicUsize::new(1), - empty_dependencies: None.into_iter().collect(), revision_canceled: Default::default(), revisions: (0..durabilities).map(|_| AtomicRevision::start()).collect(), dependency_graph: Default::default(),