[libcxx-commits] [libcxx] [libc++][test] Fix unused and nodiscard warnings (PR #73437)

via libcxx-commits libcxx-commits at lists.llvm.org
Sun Nov 26 02:55:25 PST 2023


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 9ba74c2ee044381544c8e1e736c4c85a1a9d56bf fa7af926d893140d66749dd14bad220d8f433a3b -- libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/complexity.pass.cpp libcxx/test/std/containers/sequences/deque/deque.cons/from_range.pass.cpp libcxx/test/std/containers/sequences/deque/deque.modifiers/append_range.pass.cpp libcxx/test/std/containers/sequences/deque/deque.modifiers/assign_range.pass.cpp libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_range.pass.cpp libcxx/test/std/containers/sequences/deque/deque.modifiers/prepend_range.pass.cpp libcxx/test/std/containers/sequences/vector.bool/append_range.pass.cpp libcxx/test/std/containers/sequences/vector.bool/assign_range.pass.cpp libcxx/test/std/containers/sequences/vector.bool/construct_from_range.pass.cpp libcxx/test/std/containers/sequences/vector.bool/insert_range.pass.cpp libcxx/test/std/containers/sequences/vector/vector.cons/construct_from_range.pass.cpp libcxx/test/std/containers/sequences/vector/vector.modifiers/append_range.pass.cpp libcxx/test/std/containers/sequences/vector/vector.modifiers/assign_range.pass.cpp libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_range.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_append/append_range.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_assign/assign_range.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_insert/insert_range.pass.cpp libcxx/test/std/thread/futures/futures.future_error/what.pass.cpp libcxx/test/std/utilities/function.objects/func.invoke/invoke_r.pass.cpp libcxx/test/support/deduction_guides_sfinae_checks.h
``````````

</details>

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

``````````diff
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/append_range.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/append_range.pass.cpp
index 701282bcef..d88e9f9573 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/append_range.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/append_range.pass.cpp
@@ -23,9 +23,8 @@
 
 constexpr bool test_constexpr() {
   for_all_iterators_and_allocators_constexpr<char, const char*>([]<class Iter, class Sent, class Alloc>() {
-    test_sequence_append_range<std::basic_string<char, std::char_traits<char>, Alloc>, Iter, Sent>([]([[maybe_unused]] auto&& c) {
-      LIBCPP_ASSERT(c.__invariants());
-    });
+    test_sequence_append_range<std::basic_string<char, std::char_traits<char>, Alloc>, Iter, Sent>(
+        []([[maybe_unused]] auto&& c) { LIBCPP_ASSERT(c.__invariants()); });
   });
 
   return true;
@@ -35,9 +34,8 @@ int main(int, char**) {
   static_assert(test_constraints_append_range<std::basic_string, char, int>());
 
   for_all_iterators_and_allocators<char, const char*>([]<class Iter, class Sent, class Alloc>() {
-    test_sequence_append_range<std::basic_string<char, std::char_traits<char>, Alloc>, Iter, Sent>([]([[maybe_unused]] auto&& c) {
-      LIBCPP_ASSERT(c.__invariants());
-    });
+    test_sequence_append_range<std::basic_string<char, std::char_traits<char>, Alloc>, Iter, Sent>(
+        []([[maybe_unused]] auto&& c) { LIBCPP_ASSERT(c.__invariants()); });
   });
   static_assert(test_constexpr());
 
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/assign_range.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/assign_range.pass.cpp
index c11a97f3db..d51326f383 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/assign_range.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/assign_range.pass.cpp
@@ -23,9 +23,8 @@
 
 constexpr bool test_constexpr() {
   for_all_iterators_and_allocators_constexpr<char, const char*>([]<class Iter, class Sent, class Alloc>() {
-    test_sequence_assign_range<std::basic_string<char, std::char_traits<char>, Alloc>, Iter, Sent>([]([[maybe_unused]] auto&& c) {
-      LIBCPP_ASSERT(c.__invariants());
-    });
+    test_sequence_assign_range<std::basic_string<char, std::char_traits<char>, Alloc>, Iter, Sent>(
+        []([[maybe_unused]] auto&& c) { LIBCPP_ASSERT(c.__invariants()); });
   });
 
   return true;
@@ -35,9 +34,8 @@ int main(int, char**) {
   static_assert(test_constraints_assign_range<std::basic_string, char, int>());
 
   for_all_iterators_and_allocators<char, const char*>([]<class Iter, class Sent, class Alloc>() {
-    test_sequence_assign_range<std::basic_string<char, std::char_traits<char>, Alloc>, Iter, Sent>([]([[maybe_unused]] auto&& c) {
-      LIBCPP_ASSERT(c.__invariants());
-    });
+    test_sequence_assign_range<std::basic_string<char, std::char_traits<char>, Alloc>, Iter, Sent>(
+        []([[maybe_unused]] auto&& c) { LIBCPP_ASSERT(c.__invariants()); });
   });
   static_assert(test_constexpr());
 
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/insert_range.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/insert_range.pass.cpp
index e66a870d0b..45d1f620e9 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/insert_range.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/insert_range.pass.cpp
@@ -23,9 +23,8 @@
 
 constexpr bool test_constexpr() {
   for_all_iterators_and_allocators_constexpr<char, const char*>([]<class Iter, class Sent, class Alloc>() {
-    test_sequence_insert_range<std::basic_string<char, std::char_traits<char>, Alloc>, Iter, Sent>([]([[maybe_unused]] auto&& c) {
-      LIBCPP_ASSERT(c.__invariants());
-    });
+    test_sequence_insert_range<std::basic_string<char, std::char_traits<char>, Alloc>, Iter, Sent>(
+        []([[maybe_unused]] auto&& c) { LIBCPP_ASSERT(c.__invariants()); });
   });
 
   return true;
@@ -35,9 +34,8 @@ int main(int, char**) {
   static_assert(test_constraints_insert_range<std::basic_string, char, int>());
 
   for_all_iterators_and_allocators<char, const char*>([]<class Iter, class Sent, class Alloc>() {
-    test_sequence_insert_range<std::basic_string<char, std::char_traits<char>, Alloc>, Iter, Sent>([]([[maybe_unused]] auto&& c) {
-      LIBCPP_ASSERT(c.__invariants());
-    });
+    test_sequence_insert_range<std::basic_string<char, std::char_traits<char>, Alloc>, Iter, Sent>(
+        []([[maybe_unused]] auto&& c) { LIBCPP_ASSERT(c.__invariants()); });
   });
   static_assert(test_constexpr());
 

``````````

</details>


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


More information about the libcxx-commits mailing list