Skip to content

Commit

Permalink
Small touches & cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Dherse committed Jul 7, 2024
1 parent 74c3fff commit bc50bb5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ where
F: FnOnce(In::Tracked<'c>) -> Out,
{
// Early bypass if memoization is disabled.
// Hopefully the compiler will optimize this away, if the condition is constant.
if !enabled {
return memoized_disabled(input, constraint, func);
}
Expand Down Expand Up @@ -79,7 +80,7 @@ where
output
}

pub fn memoized_disabled<'c, In, Out, F>(
fn memoized_disabled<'c, In, Out, F>(
input: In,
constraint: &'c In::Constraint,
func: F,
Expand All @@ -96,6 +97,7 @@ where
// Add the new constraints to the outer ones.
outer.join(constraint);

// Ensure that the last call was a miss during testing.
#[cfg(feature = "testing")]
LAST_WAS_HIT.with(|cell| cell.set(false));

Expand Down
4 changes: 1 addition & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ pub use comemo_macros::{memoize, track};
pub mod internal {
pub use parking_lot::RwLock;

pub use crate::cache::{
memoized, memoized_disabled, register_evictor, Cache, CacheData,
};
pub use crate::cache::{memoized, register_evictor, Cache, CacheData};
pub use crate::constraint::{hash, Call, ImmutableConstraint, MutableConstraint};
pub use crate::input::{assert_hashable_or_trackable, Args, Input};
pub use crate::track::{to_parts_mut_mut, to_parts_mut_ref, to_parts_ref, Surfaces};
Expand Down

0 comments on commit bc50bb5

Please sign in to comment.