diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index 2dbeaf889..6497b17c1 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -360,7 +360,6 @@ ''^src/libutil/linux/namespaces\.cc$'' ''^src/libutil/logging\.cc$'' ''^src/libutil/include/nix/util/logging\.hh$'' - ''^src/libutil/include/nix/util/lru-cache\.hh$'' ''^src/libutil/memory-source-accessor\.cc$'' ''^src/libutil/include/nix/util/memory-source-accessor\.hh$'' ''^src/libutil/include/nix/util/pool\.hh$'' diff --git a/src/libutil/include/nix/util/lru-cache.hh b/src/libutil/include/nix/util/lru-cache.hh index 6e14cac35..5fa3b34a6 100644 --- a/src/libutil/include/nix/util/lru-cache.hh +++ b/src/libutil/include/nix/util/lru-cache.hh @@ -25,21 +25,28 @@ private: using Data = std::map>; using LRU = std::list; - struct LRUIterator { typename LRU::iterator it; }; + struct LRUIterator + { + typename LRU::iterator it; + }; Data data; LRU lru; public: - LRUCache(size_t capacity) : capacity(capacity) { } + LRUCache(size_t capacity) + : capacity(capacity) + { + } /** * Insert or upsert an item in the cache. */ void upsert(const Key & key, const Value & value) { - if (capacity == 0) return; + if (capacity == 0) + return; erase(key); @@ -64,7 +71,8 @@ public: bool erase(const Key & key) { auto i = data.find(key); - if (i == data.end()) return false; + if (i == data.end()) + return false; lru.erase(i->second.first.it); data.erase(i); return true; @@ -77,7 +85,8 @@ public: std::optional get(const Key & key) { auto i = data.find(key); - if (i == data.end()) return {}; + if (i == data.end()) + return {}; /** * Move this item to the back of the LRU list.