From 1333fe21d089b42839696e45b67a728405b46669 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 28 Aug 2022 15:16:00 +0200 Subject: [PATCH] Fix clang warning regarding useless braces when using HashSet clang/clangd complain about the new HashSet type: hash_map.cc:98:20: warning: braces around scalar initializer [-Wbraced-scalar-init] set.insert({10}); ^~~~ The argument to HashSet::insert is just an int, so we don't need braces. Only an actual HashMap would need braces to construct a HashItem object. --- src/hash_map.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/hash_map.cc b/src/hash_map.cc index 245ff206..ae486490 100644 --- a/src/hash_map.cc +++ b/src/hash_map.cc @@ -95,8 +95,8 @@ UnitTest test_hash_set{[] { // Basic usage { HashSet set; - set.insert({10}); - set.insert({20}); + set.insert(10); + set.insert(20); kak_assert(set.find_index(0) == -1); kak_assert(set.find_index(10) == 0); kak_assert(set.find_index(20) == 1); @@ -113,8 +113,8 @@ UnitTest test_hash_set{[] { // Replace Multiple entries with the same key { HashSet set; - set.insert({10}); - set.insert({10}); + set.insert(10); + set.insert(10); kak_assert(set.find_index(10) == 0); kak_assert(set.size() == 1); set.remove(10); @@ -124,15 +124,15 @@ UnitTest test_hash_set{[] { // Multiple entries with the same key { MultiHashSet set; - set.insert({10}); - set.insert({10}); + set.insert(10); + set.insert(10); kak_assert(set.find_index(10) == 0); set.remove(10); kak_assert(set.find_index(10) == 0); set.remove(10); kak_assert(set.find_index(10) == -1); - set.insert({20}); - set.insert({20}); + set.insert(20); + set.insert(20); set.remove_all(20); kak_assert(set.find_index(20) == -1); } @@ -140,7 +140,7 @@ UnitTest test_hash_set{[] { // Check hash compatible support { HashSet set; - set.insert({"test"}); + set.insert("test"); kak_assert(set["test"_sv] == "test"); set.remove("test"_sv); }