Condense namespaces in tint/utils.

This PR condenses the namespaces in the tint/utils folder.

Change-Id: I6b541a6383386346a0b11ba46074a5981fe75f66
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86028
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
diff --git a/src/tint/utils/defer.h b/src/tint/utils/defer.h
index 4be704e..ce586f9 100644
--- a/src/tint/utils/defer.h
+++ b/src/tint/utils/defer.h
@@ -19,8 +19,7 @@
 
 #include "src/tint/utils/concat.h"
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 
 /// Defer executes a function or function like object when it is destructed.
 template <typename F>
@@ -51,8 +50,7 @@
   return Defer<F>(std::forward<F>(f));
 }
 
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
 
 /// TINT_DEFER(S) executes the statement(s) `S` when exiting the current lexical
 /// scope.
diff --git a/src/tint/utils/defer_test.cc b/src/tint/utils/defer_test.cc
index fe1034c..27fd9b5 100644
--- a/src/tint/utils/defer_test.cc
+++ b/src/tint/utils/defer_test.cc
@@ -16,8 +16,7 @@
 
 #include "gtest/gtest.h"
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 namespace {
 
 TEST(DeferTest, Basic) {
@@ -40,5 +39,4 @@
 }
 
 }  // namespace
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
diff --git a/src/tint/utils/enum_set.h b/src/tint/utils/enum_set.h
index a4fc621..c5af0f9 100644
--- a/src/tint/utils/enum_set.h
+++ b/src/tint/utils/enum_set.h
@@ -21,8 +21,7 @@
 #include <type_traits>
 #include <utility>
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 
 /// EnumSet is a set of enum values.
 /// @note As the EnumSet is backed by a single uint64_t value, it can only hold
@@ -237,8 +236,7 @@
   return out << "}";
 }
 
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
 
 namespace std {
 
diff --git a/src/tint/utils/enum_set_test.cc b/src/tint/utils/enum_set_test.cc
index 566701c..f0e4e67 100644
--- a/src/tint/utils/enum_set_test.cc
+++ b/src/tint/utils/enum_set_test.cc
@@ -19,8 +19,7 @@
 
 #include "gmock/gmock.h"
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 namespace {
 
 using ::testing::ElementsAre;
@@ -240,5 +239,4 @@
 }
 
 }  // namespace
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
diff --git a/src/tint/utils/hash.h b/src/tint/utils/hash.h
index 1158021..e043e81 100644
--- a/src/tint/utils/hash.h
+++ b/src/tint/utils/hash.h
@@ -20,8 +20,7 @@
 #include <functional>
 #include <vector>
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 namespace detail {
 
 /// Helper for obtaining a seed bias value for HashCombine with a bit-width
@@ -77,7 +76,6 @@
   return hash;
 }
 
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
 
 #endif  // SRC_TINT_UTILS_HASH_H_
diff --git a/src/tint/utils/hash_test.cc b/src/tint/utils/hash_test.cc
index caeba57..ec88a8c 100644
--- a/src/tint/utils/hash_test.cc
+++ b/src/tint/utils/hash_test.cc
@@ -18,8 +18,7 @@
 
 #include "gtest/gtest.h"
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 namespace {
 
 TEST(HashTests, Basic) {
@@ -45,5 +44,4 @@
 }
 
 }  // namespace
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
diff --git a/src/tint/utils/io/command.h b/src/tint/utils/io/command.h
index dbf587e..63ddab8 100644
--- a/src/tint/utils/io/command.h
+++ b/src/tint/utils/io/command.h
@@ -18,8 +18,7 @@
 #include <string>
 #include <utility>
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 
 /// Command is a helper used by tests for executing a process with a number of
 /// arguments and an optional stdin string, and then collecting and returning
@@ -78,7 +77,6 @@
   std::string input_;
 };
 
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
 
 #endif  // SRC_TINT_UTILS_IO_COMMAND_H_
diff --git a/src/tint/utils/io/command_other.cc b/src/tint/utils/io/command_other.cc
index 5562e37..5ae73da 100644
--- a/src/tint/utils/io/command_other.cc
+++ b/src/tint/utils/io/command_other.cc
@@ -14,8 +14,7 @@
 
 #include "src/tint/utils/io/command.h"
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 
 Command::Command(const std::string&) {}
 
@@ -33,5 +32,4 @@
   return out;
 }
 
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
diff --git a/src/tint/utils/io/command_posix.cc b/src/tint/utils/io/command_posix.cc
index dc60684..3696921 100644
--- a/src/tint/utils/io/command_posix.cc
+++ b/src/tint/utils/io/command_posix.cc
@@ -21,8 +21,7 @@
 #include <sstream>
 #include <vector>
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 
 namespace {
 
@@ -261,5 +260,4 @@
   }
 }
 
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
diff --git a/src/tint/utils/io/command_test.cc b/src/tint/utils/io/command_test.cc
index f76dcae..1b8bb83 100644
--- a/src/tint/utils/io/command_test.cc
+++ b/src/tint/utils/io/command_test.cc
@@ -16,8 +16,7 @@
 
 #include "gtest/gtest.h"
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 namespace {
 
 #ifdef _WIN32
@@ -88,5 +87,4 @@
 #endif
 
 }  // namespace
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
diff --git a/src/tint/utils/io/command_windows.cc b/src/tint/utils/io/command_windows.cc
index 576fc4c..d59f849 100644
--- a/src/tint/utils/io/command_windows.cc
+++ b/src/tint/utils/io/command_windows.cc
@@ -19,8 +19,7 @@
 #include <sstream>
 #include <string>
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 
 namespace {
 
@@ -245,5 +244,4 @@
   return output;
 }
 
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
diff --git a/src/tint/utils/io/tmpfile.h b/src/tint/utils/io/tmpfile.h
index 07f48af..6f81a891e 100644
--- a/src/tint/utils/io/tmpfile.h
+++ b/src/tint/utils/io/tmpfile.h
@@ -18,8 +18,7 @@
 #include <sstream>
 #include <string>
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 
 /// TmpFile constructs a temporary file that can be written to, and is
 /// automatically deleted on destruction.
@@ -70,7 +69,6 @@
   std::string path_;
 };
 
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
 
 #endif  // SRC_TINT_UTILS_IO_TMPFILE_H_
diff --git a/src/tint/utils/io/tmpfile_other.cc b/src/tint/utils/io/tmpfile_other.cc
index b4c1a18..7ddbb58 100644
--- a/src/tint/utils/io/tmpfile_other.cc
+++ b/src/tint/utils/io/tmpfile_other.cc
@@ -14,8 +14,7 @@
 
 #include "src/tint/utils/io/tmpfile.h"
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 
 TmpFile::TmpFile(std::string) {}
 
@@ -25,5 +24,4 @@
   return false;
 }
 
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
diff --git a/src/tint/utils/io/tmpfile_posix.cc b/src/tint/utils/io/tmpfile_posix.cc
index db9ee47..00c20fe 100644
--- a/src/tint/utils/io/tmpfile_posix.cc
+++ b/src/tint/utils/io/tmpfile_posix.cc
@@ -19,8 +19,7 @@
 
 #include "src/tint/debug.h"
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 
 namespace {
 
@@ -66,5 +65,4 @@
   return false;
 }
 
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
diff --git a/src/tint/utils/io/tmpfile_test.cc b/src/tint/utils/io/tmpfile_test.cc
index abd9511..d312922 100644
--- a/src/tint/utils/io/tmpfile_test.cc
+++ b/src/tint/utils/io/tmpfile_test.cc
@@ -18,8 +18,7 @@
 
 #include "gtest/gtest.h"
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 namespace {
 
 TEST(TmpFileTest, WriteReadAppendDelete) {
@@ -86,5 +85,4 @@
 }
 
 }  // namespace
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
diff --git a/src/tint/utils/io/tmpfile_windows.cc b/src/tint/utils/io/tmpfile_windows.cc
index 2b57b68..40dffc8 100644
--- a/src/tint/utils/io/tmpfile_windows.cc
+++ b/src/tint/utils/io/tmpfile_windows.cc
@@ -17,8 +17,7 @@
 #include <stdio.h>
 #include <cstdio>
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 
 namespace {
 
@@ -59,5 +58,4 @@
   return true;
 }
 
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
diff --git a/src/tint/utils/map.h b/src/tint/utils/map.h
index 0f60d13..12c93d4 100644
--- a/src/tint/utils/map.h
+++ b/src/tint/utils/map.h
@@ -17,8 +17,7 @@
 
 #include <unordered_map>
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 
 /// Lookup is a utility function for fetching a value from an unordered map if
 /// it exists, otherwise returning the `if_missing` argument.
@@ -56,7 +55,6 @@
   return value;
 }
 
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
 
 #endif  // SRC_TINT_UTILS_MAP_H_
diff --git a/src/tint/utils/map_test.cc b/src/tint/utils/map_test.cc
index a1e8dec..ae35aeb 100644
--- a/src/tint/utils/map_test.cc
+++ b/src/tint/utils/map_test.cc
@@ -18,8 +18,7 @@
 
 #include "gtest/gtest.h"
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 namespace {
 
 TEST(Lookup, Test) {
@@ -54,5 +53,4 @@
 }
 
 }  // namespace
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
diff --git a/src/tint/utils/math.h b/src/tint/utils/math.h
index 155e39f..c6d7d46 100644
--- a/src/tint/utils/math.h
+++ b/src/tint/utils/math.h
@@ -19,8 +19,7 @@
 #include <string>
 #include <type_traits>
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 
 /// @param alignment the next multiple to round `value` to
 /// @param value the value to round to the next multiple of `alignment`
@@ -51,7 +50,6 @@
   return pot;
 }
 
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
 
 #endif  // SRC_TINT_UTILS_MATH_H_
diff --git a/src/tint/utils/math_test.cc b/src/tint/utils/math_test.cc
index 057f142..d6be3f6 100644
--- a/src/tint/utils/math_test.cc
+++ b/src/tint/utils/math_test.cc
@@ -16,8 +16,7 @@
 
 #include "gtest/gtest.h"
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 namespace {
 
 TEST(MathTests, RoundUp) {
@@ -79,5 +78,4 @@
 }
 
 }  // namespace
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
diff --git a/src/tint/utils/reverse.h b/src/tint/utils/reverse.h
index 17b1346..fb4f237 100644
--- a/src/tint/utils/reverse.h
+++ b/src/tint/utils/reverse.h
@@ -17,8 +17,7 @@
 
 #include <iterator>
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 
 namespace detail {
 /// Used by utils::Reverse to hold the underlying iterable.
@@ -58,7 +57,6 @@
   return {iterable};
 }
 
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
 
 #endif  // SRC_TINT_UTILS_REVERSE_H_
diff --git a/src/tint/utils/reverse_test.cc b/src/tint/utils/reverse_test.cc
index 64734cd..b23c799 100644
--- a/src/tint/utils/reverse_test.cc
+++ b/src/tint/utils/reverse_test.cc
@@ -18,8 +18,7 @@
 
 #include "gmock/gmock.h"
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 namespace {
 
 TEST(ReverseTest, Vector) {
@@ -32,5 +31,4 @@
 }
 
 }  // namespace
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
diff --git a/src/tint/utils/scoped_assignment.h b/src/tint/utils/scoped_assignment.h
index 0ff3421..fdd787f 100644
--- a/src/tint/utils/scoped_assignment.h
+++ b/src/tint/utils/scoped_assignment.h
@@ -20,8 +20,7 @@
 
 #include "src/tint/utils/concat.h"
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 
 /// Helper class that temporarily assigns a value to a variable for the lifetime
 /// of the ScopedAssignment object. Once the ScopedAssignment is destructed, the
@@ -50,8 +49,7 @@
   T old_value_;
 };
 
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
 
 /// TINT_SCOPED_ASSIGNMENT(var, val) assigns `val` to `var`, and automatically
 /// restores the original value of `var` when exiting the current lexical scope.
diff --git a/src/tint/utils/scoped_assignment_test.cc b/src/tint/utils/scoped_assignment_test.cc
index 20cd8d0..3055afe 100644
--- a/src/tint/utils/scoped_assignment_test.cc
+++ b/src/tint/utils/scoped_assignment_test.cc
@@ -16,8 +16,7 @@
 
 #include "gtest/gtest.h"
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 namespace {
 
 TEST(ScopedAssignmentTest, Scopes) {
@@ -43,5 +42,4 @@
 }
 
 }  // namespace
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
diff --git a/src/tint/utils/string.h b/src/tint/utils/string.h
index 0355819..011e326 100644
--- a/src/tint/utils/string.h
+++ b/src/tint/utils/string.h
@@ -17,8 +17,7 @@
 
 #include <string>
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 
 /// @param str the string to apply replacements to
 /// @param substr the string to search for
@@ -35,7 +34,6 @@
   return str;
 }
 
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
 
 #endif  // SRC_TINT_UTILS_STRING_H_
diff --git a/src/tint/utils/string_test.cc b/src/tint/utils/string_test.cc
index 3dbb486..f394ed7 100644
--- a/src/tint/utils/string_test.cc
+++ b/src/tint/utils/string_test.cc
@@ -16,8 +16,7 @@
 
 #include "gtest/gtest.h"
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 namespace {
 
 TEST(StringTest, ReplaceAll) {
@@ -34,5 +33,4 @@
 }
 
 }  // namespace
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
diff --git a/src/tint/utils/to_const_ptr_vec.h b/src/tint/utils/to_const_ptr_vec.h
index e36fe0c..a46b3ba 100644
--- a/src/tint/utils/to_const_ptr_vec.h
+++ b/src/tint/utils/to_const_ptr_vec.h
@@ -18,8 +18,7 @@
 
 #include <vector>
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 
 /// @param in a vector of `T*`
 /// @returns a vector of `const T*` with the content of `in`.
@@ -33,7 +32,6 @@
   return out;
 }
 
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
 
 #endif  // SRC_TINT_UTILS_TO_CONST_PTR_VEC_H_
diff --git a/src/tint/utils/transform.h b/src/tint/utils/transform.h
index 97711fd..29a9740 100644
--- a/src/tint/utils/transform.h
+++ b/src/tint/utils/transform.h
@@ -22,8 +22,7 @@
 
 #include "src/tint/traits.h"
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 
 /// Transform performs an element-wise transformation of a vector.
 /// @param in the input vector.
@@ -56,7 +55,6 @@
   return result;
 }
 
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
 
 #endif  // SRC_TINT_UTILS_TRANSFORM_H_
diff --git a/src/tint/utils/transform_test.cc b/src/tint/utils/transform_test.cc
index 6686eeb..e668824 100644
--- a/src/tint/utils/transform_test.cc
+++ b/src/tint/utils/transform_test.cc
@@ -23,8 +23,7 @@
   static_assert(std::is_same<decltype(vector)::value_type, expected>::value, \
                 "unexpected result vector element type")
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 namespace {
 
 TEST(TransformTest, Empty) {
@@ -90,5 +89,4 @@
 }
 
 }  // namespace
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
diff --git a/src/tint/utils/unique_vector.h b/src/tint/utils/unique_vector.h
index 96d3ac3..32d593e 100644
--- a/src/tint/utils/unique_vector.h
+++ b/src/tint/utils/unique_vector.h
@@ -21,8 +21,7 @@
 #include <utility>
 #include <vector>
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 
 /// UniqueVector is an ordered container that only contains unique items.
 /// Attempting to add a duplicate is a no-op.
@@ -107,7 +106,6 @@
   std::unordered_set<T, HASH, EQUAL> set;
 };
 
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils
 
 #endif  // SRC_TINT_UTILS_UNIQUE_VECTOR_H_
diff --git a/src/tint/utils/unique_vector_test.cc b/src/tint/utils/unique_vector_test.cc
index 892282b..c2c47a4 100644
--- a/src/tint/utils/unique_vector_test.cc
+++ b/src/tint/utils/unique_vector_test.cc
@@ -17,8 +17,7 @@
 
 #include "gtest/gtest.h"
 
-namespace tint {
-namespace utils {
+namespace tint::utils {
 namespace {
 
 TEST(UniqueVectorTest, Empty) {
@@ -141,5 +140,4 @@
 }
 
 }  // namespace
-}  // namespace utils
-}  // namespace tint
+}  // namespace tint::utils