From 9dcf6c7b2633298b1b9c7fe4703a825a13511370 Mon Sep 17 00:00:00 2001 From: Jerome Froelich Date: Mon, 13 Jun 2022 20:43:44 -0400 Subject: [PATCH] Use FnOnce instead of Fn --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index da317b3..f45a406 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -452,8 +452,8 @@ impl LruCache { /// Returns a reference to the value of the key in the cache if it is /// present in the cache and moves the key to the head of the LRU list. - /// If the key does not exist the provided `Fn` is used to populate the list and a reference - /// is returned. + /// If the key does not exist the provided `FnOnce` is used to populate + /// the list and a reference is returned. /// /// This method will only return `None` when the capacity of the cache is 0 and no entries /// can be populated. @@ -476,7 +476,7 @@ impl LruCache { /// ``` pub fn get_or_insert<'a, F>(&'a mut self, k: K, f: F) -> Option<&'a V> where - F: Fn() -> V, + F: FnOnce() -> V, { if let Some(node) = self.map.get_mut(&KeyRef { k: &k }) { let node_ptr: *mut LruEntry = &mut **node;