From 4c58be255a5dae17d14855016a7af4329d85a3d9 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Wed, 28 Jan 2026 13:34:48 +0100 Subject: [PATCH] AK: Remove HashMap::hash() Using `pair_int_hash()` which subsequently uses `int_hash()` means that ordering of the input is important. Since this operates on unordered HashMaps as well, order of the keys and values is dependent on the internal implementation of HashTable and might differ between HashMaps with identical contents, making this implementation of `::hash()` not that useful. Fortunately, it is unused, so let's remove this footgun. --- AK/HashMap.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/AK/HashMap.h b/AK/HashMap.h index a01ba835d0..3911262f01 100644 --- a/AK/HashMap.h +++ b/AK/HashMap.h @@ -301,16 +301,6 @@ public: return list; } - [[nodiscard]] u32 hash() const - { - u32 hash = 0; - for (auto const& [key, value] : *this) { - auto entry_hash = pair_int_hash(key.hash(), value.hash()); - hash = pair_int_hash(hash, entry_hash); - } - return hash; - } - template ErrorOr> clone() const {