[libcxx-commits] [libcxx] [libc++][unordered_set] Applied `[[nodiscard]]` (PR #170435)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 2 23:06:49 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions ,cpp -- libcxx/test/libcxx/diagnostics/unordered_multiset.nodiscard.verify.cpp libcxx/include/unordered_set libcxx/test/libcxx/diagnostics/unordered_set.nodiscard.verify.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set
index 8f531f4fe..6243983f3 100644
--- a/libcxx/include/unordered_set
+++ b/libcxx/include/unordered_set
@@ -891,16 +891,24 @@ public:
 #  endif // _LIBCPP_STD_VER >= 20
 
   [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __table_.bucket_count(); }
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT { return __table_.max_bucket_count(); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT {
+    return __table_.max_bucket_count();
+  }
 
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const { return __table_.bucket_size(__n); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const {
+    return __table_.bucket_size(__n);
+  }
   [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type bucket(const key_type& __k) const { return __table_.bucket(__k); }
 
   [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) { return __table_.begin(__n); }
   [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) { return __table_.end(__n); }
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const { return __table_.cbegin(__n); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const {
+    return __table_.cbegin(__n);
+  }
   [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator end(size_type __n) const { return __table_.cend(__n); }
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const { return __table_.cbegin(__n); }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const {
+    return __table_.cbegin(__n);
+  }
   [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const { return __table_.cend(__n); }
 
   [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT { return __table_.load_factor(); }
diff --git a/libcxx/test/libcxx/diagnostics/unordered_multiset.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/unordered_multiset.nodiscard.verify.cpp
index 7f9152842..16eec2a7b 100644
--- a/libcxx/test/libcxx/diagnostics/unordered_multiset.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/unordered_multiset.nodiscard.verify.cpp
@@ -8,7 +8,6 @@
 
 // UNSUPPORTED: c++03
 
-
 // Check that functions are marked [[nodiscard]]
 
 #include <unordered_set>

``````````

</details>


https://github.com/llvm/llvm-project/pull/170435


More information about the libcxx-commits mailing list