From fe7726efa69190acdbcfe551e11afe5ed8c731ba Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sun, 16 Mar 2025 12:44:19 +0100 Subject: [PATCH] chore: Remove dead code --- src/accumulator.rs | 5 ----- src/function.rs | 15 ++++----------- src/ingredient.rs | 6 ------ src/input.rs | 5 ----- src/input/input_field.rs | 5 ----- src/interned.rs | 4 ---- src/tracked_struct.rs | 5 ----- src/tracked_struct/tracked_field.rs | 4 ---- 8 files changed, 4 insertions(+), 45 deletions(-) diff --git a/src/accumulator.rs b/src/accumulator.rs index dfa36fcf8..cd2ec2b9b 100644 --- a/src/accumulator.rs +++ b/src/accumulator.rs @@ -11,7 +11,6 @@ use accumulated::Accumulated; use accumulated::AnyAccumulated; use crate::{ - cycle::CycleRecoveryStrategy, function::VerifyResult, ingredient::{fmt_index, Ingredient, Jar}, plumbing::IngredientIndices, @@ -118,10 +117,6 @@ impl Ingredient for IngredientImpl { true } - fn cycle_recovery_strategy(&self) -> CycleRecoveryStrategy { - CycleRecoveryStrategy::Panic - } - fn origin(&self, _db: &dyn Database, _key_index: crate::Id) -> Option { None } diff --git a/src/function.rs b/src/function.rs index 08138fdf6..968b5d37c 100644 --- a/src/function.rs +++ b/src/function.rs @@ -54,7 +54,7 @@ pub trait Configuration: Any { /// (and, if so, how). const CYCLE_STRATEGY: CycleRecoveryStrategy; - /// Invokes after a new result `new_value`` has been computed for which an older memoized value + /// Invokes after a new result `new_value` has been computed for which an older memoized value /// existed `old_value`, or in fixpoint iteration. Returns true if the new value is equal to /// the older one. /// @@ -243,12 +243,9 @@ where /// True if the input `input` contains a memo that cites itself as a cycle head. /// This indicates an intermediate value for a cycle that has not yet reached a fixed point. fn is_provisional_cycle_head<'db>(&'db self, db: &'db dyn Database, input: Id) -> bool { - self.get_memo_from_table_for( - db.zalsa(), - input, - self.memo_ingredient_index(db.zalsa(), input), - ) - .is_some_and(|memo| memo.cycle_heads().contains(&self.database_key_index(input))) + let zalsa = db.zalsa(); + self.get_memo_from_table_for(zalsa, input, self.memo_ingredient_index(zalsa, input)) + .is_some_and(|memo| memo.cycle_heads().contains(&self.database_key_index(input))) } /// Attempts to claim `key_index`, returning `false` if a cycle occurs. @@ -265,10 +262,6 @@ where } } - fn cycle_recovery_strategy(&self) -> CycleRecoveryStrategy { - C::CYCLE_STRATEGY - } - fn origin(&self, db: &dyn Database, key: Id) -> Option { self.origin(db.zalsa(), key) } diff --git a/src/ingredient.rs b/src/ingredient.rs index 0dcbb1d52..e0c4202ee 100644 --- a/src/ingredient.rs +++ b/src/ingredient.rs @@ -5,7 +5,6 @@ use std::{ use crate::{ accumulator::accumulated_map::{AccumulatedMap, InputAccumulatedValues}, - cycle::CycleRecoveryStrategy, function::VerifyResult, plumbing::IngredientIndices, table::Table, @@ -117,11 +116,6 @@ pub trait Ingredient: Any + std::fmt::Debug + Send + Sync { /// Returns the [`IngredientIndex`] of this ingredient. fn ingredient_index(&self) -> IngredientIndex; - /// If this ingredient is a participant in a cycle, what is its cycle recovery strategy? - /// (Really only relevant to [`crate::function::FunctionIngredient`], - /// since only function ingredients push themselves onto the active query stack.) - fn cycle_recovery_strategy(&self) -> CycleRecoveryStrategy; - /// Returns true if `reset_for_new_revision` should be called when new revisions start. /// Invoked once when ingredient is added and not after that. fn requires_reset_for_new_revision(&self) -> bool { diff --git a/src/input.rs b/src/input.rs index 4eb6be1e6..52ee03178 100644 --- a/src/input.rs +++ b/src/input.rs @@ -11,7 +11,6 @@ pub mod singleton; use input_field::FieldIngredientImpl; use crate::{ - cycle::CycleRecoveryStrategy, function::VerifyResult, id::{AsId, FromIdWithDb}, ingredient::{fmt_index, Ingredient}, @@ -233,10 +232,6 @@ impl Ingredient for IngredientImpl { true } - fn cycle_recovery_strategy(&self) -> CycleRecoveryStrategy { - CycleRecoveryStrategy::Panic - } - fn origin(&self, _db: &dyn Database, _key_index: Id) -> Option { None } diff --git a/src/input/input_field.rs b/src/input/input_field.rs index 6f5f9c226..1ee93fdc2 100644 --- a/src/input/input_field.rs +++ b/src/input/input_field.rs @@ -1,4 +1,3 @@ -use crate::cycle::CycleRecoveryStrategy; use crate::function::VerifyResult; use crate::ingredient::{fmt_index, Ingredient}; use crate::input::Configuration; @@ -46,10 +45,6 @@ where self.index } - fn cycle_recovery_strategy(&self) -> CycleRecoveryStrategy { - CycleRecoveryStrategy::Panic - } - unsafe fn maybe_changed_after( &self, db: &dyn Database, diff --git a/src/interned.rs b/src/interned.rs index e1087c1c9..76329b2c6 100644 --- a/src/interned.rs +++ b/src/interned.rs @@ -298,10 +298,6 @@ where true } - fn cycle_recovery_strategy(&self) -> crate::cycle::CycleRecoveryStrategy { - crate::cycle::CycleRecoveryStrategy::Panic - } - fn origin(&self, _db: &dyn Database, _key_index: crate::Id) -> Option { None } diff --git a/src/tracked_struct.rs b/src/tracked_struct.rs index b5d94a07c..eed7b5215 100644 --- a/src/tracked_struct.rs +++ b/src/tracked_struct.rs @@ -4,7 +4,6 @@ use crossbeam_queue::SegQueue; use tracked_field::FieldIngredientImpl; use crate::{ - cycle::CycleRecoveryStrategy, function::VerifyResult, ingredient::{fmt_index, Ingredient, Jar}, key::{DatabaseKeyIndex, InputDependencyIndex}, @@ -753,10 +752,6 @@ where true } - fn cycle_recovery_strategy(&self) -> CycleRecoveryStrategy { - crate::cycle::CycleRecoveryStrategy::Panic - } - fn origin(&self, _db: &dyn Database, _key_index: crate::Id) -> Option { None } diff --git a/src/tracked_struct/tracked_field.rs b/src/tracked_struct/tracked_field.rs index 9b264949c..acdc6a09b 100644 --- a/src/tracked_struct/tracked_field.rs +++ b/src/tracked_struct/tracked_field.rs @@ -47,10 +47,6 @@ where self.ingredient_index } - fn cycle_recovery_strategy(&self) -> crate::cycle::CycleRecoveryStrategy { - crate::cycle::CycleRecoveryStrategy::Panic - } - unsafe fn maybe_changed_after<'db>( &'db self, db: &'db dyn Database,