Nest all namespaces

The compiler supports this now.  We can type less going forward.
No functional changes.

Signed-off-by: Stephan Pleines <pleines.stephan@gmail.com>
Change-Id: I29d6fa4f9aacc0e381f1a7637294db0392466995
diff --git a/y2020/actors/auto_splines.cc b/y2020/actors/auto_splines.cc
index 3ad292d..28aa996 100644
--- a/y2020/actors/auto_splines.cc
+++ b/y2020/actors/auto_splines.cc
@@ -2,8 +2,7 @@
 
 #include "frc971/control_loops/control_loops_generated.h"
 
-namespace y2020 {
-namespace actors {
+namespace y2020::actors {
 
 constexpr double kFieldLength = 16.4592;
 constexpr double kFieldWidth = 8.2296;
@@ -186,5 +185,4 @@
   return multispline_builder.Finish();
 }
 
-}  // namespace actors
-}  // namespace y2020
+}  // namespace y2020::actors
diff --git a/y2020/actors/autonomous_actor.cc b/y2020/actors/autonomous_actor.cc
index 160d36a..13b7d69 100644
--- a/y2020/actors/autonomous_actor.cc
+++ b/y2020/actors/autonomous_actor.cc
@@ -16,8 +16,7 @@
 DEFINE_bool(just_shoot, false,
             "If true, run the autonomous that just shoots balls.");
 
-namespace y2020 {
-namespace actors {
+namespace y2020::actors {
 
 using ::aos::monotonic_clock;
 using ::frc971::ProfileParametersT;
@@ -462,5 +461,4 @@
   return WaitUntilAbsoluteBallsShot(Balls() + num_wanted);
 }
 
-}  // namespace actors
-}  // namespace y2020
+}  // namespace y2020::actors
diff --git a/y2020/constants.cc b/y2020/constants.cc
index e30ef0e..b5456b4 100644
--- a/y2020/constants.cc
+++ b/y2020/constants.cc
@@ -20,8 +20,7 @@
 #include "y2020/control_loops/superstructure/intake/integral_intake_plant.h"
 #include "y2020/control_loops/superstructure/turret/integral_turret_plant.h"
 
-namespace y2020 {
-namespace constants {
+namespace y2020::constants {
 
 const int Values::kZeroingSampleSize;
 
@@ -200,5 +199,4 @@
   return *values;
 }
 
-}  // namespace constants
-}  // namespace y2020
+}  // namespace y2020::constants
diff --git a/y2020/control_loops/drivetrain/drivetrain_base.cc b/y2020/control_loops/drivetrain/drivetrain_base.cc
index 7b42df5..3e05020 100644
--- a/y2020/control_loops/drivetrain/drivetrain_base.cc
+++ b/y2020/control_loops/drivetrain/drivetrain_base.cc
@@ -15,9 +15,7 @@
 
 namespace chrono = ::std::chrono;
 
-namespace y2020 {
-namespace control_loops {
-namespace drivetrain {
+namespace y2020::control_loops::drivetrain {
 
 using ::frc971::constants::ShifterHallEffect;
 
@@ -77,6 +75,4 @@
   return kDrivetrainConfig;
 };
 
-}  // namespace drivetrain
-}  // namespace control_loops
-}  // namespace y2020
+}  // namespace y2020::control_loops::drivetrain
diff --git a/y2020/control_loops/drivetrain/drivetrain_replay_test.cc b/y2020/control_loops/drivetrain/drivetrain_replay_test.cc
index 0baf34b..731f02c 100644
--- a/y2020/control_loops/drivetrain/drivetrain_replay_test.cc
+++ b/y2020/control_loops/drivetrain/drivetrain_replay_test.cc
@@ -27,10 +27,7 @@
 DEFINE_string(config, "y2020/aos_config.json",
               "Name of the config file to replay using.");
 
-namespace y2020 {
-namespace control_loops {
-namespace drivetrain {
-namespace testing {
+namespace y2020::control_loops::drivetrain::testing {
 
 class DrivetrainReplayTest : public ::testing::Test {
  public:
@@ -135,7 +132,4 @@
   EXPECT_LT(std::abs(status_fetcher_->theta()), 0.02);
 }
 
-}  // namespace testing
-}  // namespace drivetrain
-}  // namespace control_loops
-}  // namespace y2020
+}  // namespace y2020::control_loops::drivetrain::testing
diff --git a/y2020/control_loops/drivetrain/localizer.cc b/y2020/control_loops/drivetrain/localizer.cc
index 8f8bf87..fabbb8e 100644
--- a/y2020/control_loops/drivetrain/localizer.cc
+++ b/y2020/control_loops/drivetrain/localizer.cc
@@ -6,9 +6,7 @@
             "If true, send LocalizerDebug messages on every tick, even if "
             "they would be empty.");
 
-namespace y2020 {
-namespace control_loops {
-namespace drivetrain {
+namespace y2020::control_loops::drivetrain {
 
 namespace {
 // Converts a flatbuffer TransformationMatrix to an Eigen matrix. Technically,
@@ -499,6 +497,4 @@
   return Zhat;
 }
 
-}  // namespace drivetrain
-}  // namespace control_loops
-}  // namespace y2020
+}  // namespace y2020::control_loops::drivetrain
diff --git a/y2020/control_loops/drivetrain/localizer_test.cc b/y2020/control_loops/drivetrain/localizer_test.cc
index 3e2cf6b..90076c0 100644
--- a/y2020/control_loops/drivetrain/localizer_test.cc
+++ b/y2020/control_loops/drivetrain/localizer_test.cc
@@ -19,10 +19,7 @@
 
 // This file tests that the full 2020 localizer behaves sanely.
 
-namespace y2020 {
-namespace control_loops {
-namespace drivetrain {
-namespace testing {
+namespace y2020::control_loops::drivetrain::testing {
 
 using aos::logger::BootTimestamp;
 using frc971::control_loops::drivetrain::DrivetrainConfig;
@@ -622,7 +619,4 @@
   RunFor(chrono::seconds(20));
 }
 
-}  // namespace testing
-}  // namespace drivetrain
-}  // namespace control_loops
-}  // namespace y2020
+}  // namespace y2020::control_loops::drivetrain::testing
diff --git a/y2020/control_loops/superstructure/shooter/shooter.cc b/y2020/control_loops/superstructure/shooter/shooter.cc
index c400e34..2792205 100644
--- a/y2020/control_loops/superstructure/shooter/shooter.cc
+++ b/y2020/control_loops/superstructure/shooter/shooter.cc
@@ -9,10 +9,7 @@
 #include "y2020/control_loops/superstructure/finisher/finisher_plant.h"
 #include "y2020/control_loops/superstructure/finisher/integral_finisher_plant.h"
 
-namespace y2020 {
-namespace control_loops {
-namespace superstructure {
-namespace shooter {
+namespace y2020::control_loops::superstructure::shooter {
 
 Shooter::Shooter()
     : finisher_(
@@ -141,7 +138,4 @@
   return status_builder.Finish();
 }
 
-}  // namespace shooter
-}  // namespace superstructure
-}  // namespace control_loops
-}  // namespace y2020
+}  // namespace y2020::control_loops::superstructure::shooter
diff --git a/y2020/control_loops/superstructure/superstructure.cc b/y2020/control_loops/superstructure/superstructure.cc
index b7d57b4..f951791 100644
--- a/y2020/control_loops/superstructure/superstructure.cc
+++ b/y2020/control_loops/superstructure/superstructure.cc
@@ -4,9 +4,7 @@
 #include "aos/events/event_loop.h"
 #include "aos/network/team_number.h"
 
-namespace y2020 {
-namespace control_loops {
-namespace superstructure {
+namespace y2020::control_loops::superstructure {
 
 using frc971::control_loops::AbsoluteAndAbsoluteEncoderProfiledJointStatus;
 using frc971::control_loops::AbsoluteEncoderProfiledJointStatus;
@@ -313,6 +311,4 @@
   }
 }
 
-}  // namespace superstructure
-}  // namespace control_loops
-}  // namespace y2020
+}  // namespace y2020::control_loops::superstructure
diff --git a/y2020/control_loops/superstructure/superstructure_lib_test.cc b/y2020/control_loops/superstructure/superstructure_lib_test.cc
index 8b34fc9..950593e 100644
--- a/y2020/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2020/control_loops/superstructure/superstructure_lib_test.cc
@@ -28,10 +28,7 @@
 DEFINE_string(config, "y2020/aos_config.json",
               "Name of the config file to replay using.");
 
-namespace y2020 {
-namespace control_loops {
-namespace superstructure {
-namespace testing {
+namespace y2020::control_loops::superstructure::testing {
 
 namespace {
 constexpr double kNoiseScalar = 0.01;
@@ -1473,7 +1470,4 @@
                                            aos::Alliance::kBlue,
                                            aos::Alliance::kInvalid));
 
-}  // namespace testing
-}  // namespace superstructure
-}  // namespace control_loops
-}  // namespace y2020
+}  // namespace y2020::control_loops::superstructure::testing
diff --git a/y2020/control_loops/superstructure/turret/aiming.cc b/y2020/control_loops/superstructure/turret/aiming.cc
index 0b2c5f3..238beda 100644
--- a/y2020/control_loops/superstructure/turret/aiming.cc
+++ b/y2020/control_loops/superstructure/turret/aiming.cc
@@ -3,10 +3,7 @@
 #include "y2020/constants.h"
 #include "y2020/control_loops/drivetrain/drivetrain_base.h"
 
-namespace y2020 {
-namespace control_loops {
-namespace superstructure {
-namespace turret {
+namespace y2020::control_loops::superstructure::turret {
 
 using frc971::control_loops::Pose;
 using frc971::control_loops::aiming::RobotState;
@@ -197,7 +194,4 @@
   return builder.Finish();
 }
 
-}  // namespace turret
-}  // namespace superstructure
-}  // namespace control_loops
-}  // namespace y2020
+}  // namespace y2020::control_loops::superstructure::turret
diff --git a/y2020/control_loops/superstructure/turret/aiming_test.cc b/y2020/control_loops/superstructure/turret/aiming_test.cc
index b63d705..855f66a 100644
--- a/y2020/control_loops/superstructure/turret/aiming_test.cc
+++ b/y2020/control_loops/superstructure/turret/aiming_test.cc
@@ -7,11 +7,7 @@
 #include "y2020/constants.h"
 #include "y2020/control_loops/drivetrain/drivetrain_base.h"
 
-namespace y2020 {
-namespace control_loops {
-namespace superstructure {
-namespace turret {
-namespace testing {
+namespace y2020::control_loops::superstructure::turret::testing {
 
 class TeamNumberEnvironment : public ::testing::Environment {
  public:
@@ -259,8 +255,4 @@
   EXPECT_EQ(0.0, goal->goal_velocity());
 }
 
-}  // namespace testing
-}  // namespace turret
-}  // namespace superstructure
-}  // namespace control_loops
-}  // namespace y2020
+}  // namespace y2020::control_loops::superstructure::turret::testing
diff --git a/y2020/joystick_reader.cc b/y2020/joystick_reader.cc
index 951c5a7..2aa263e 100644
--- a/y2020/joystick_reader.cc
+++ b/y2020/joystick_reader.cc
@@ -31,9 +31,7 @@
 using frc971::control_loops::CreateStaticZeroingSingleDOFProfiledSubsystemGoal;
 using frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystemGoal;
 
-namespace y2020 {
-namespace input {
-namespace joysticks {
+namespace y2020::input::joysticks {
 
 namespace superstructure = y2020::control_loops::superstructure;
 
@@ -332,9 +330,7 @@
   size_t unwinch_counter_ = 0;
 };
 
-}  // namespace joysticks
-}  // namespace input
-}  // namespace y2020
+}  // namespace y2020::input::joysticks
 
 int main(int argc, char **argv) {
   ::aos::InitGoogle(&argc, &argv);
diff --git a/y2020/vision/camera_reader.cc b/y2020/vision/camera_reader.cc
index a63becd..251f988 100644
--- a/y2020/vision/camera_reader.cc
+++ b/y2020/vision/camera_reader.cc
@@ -23,8 +23,7 @@
 DEFINE_bool(use_prev_pose, true,
             "If true, use previous pose estimate as seed for next estimate.");
 
-namespace frc971 {
-namespace vision {
+namespace frc971::vision {
 
 const sift::CameraCalibration *CameraReader::FindCameraCalibration() const {
   const std::string_view node_name = event_loop_->node()->name()->string_view();
@@ -541,5 +540,4 @@
   return fbb->CreateVector(features_vector);
 }
 
-}  // namespace vision
-}  // namespace frc971
+}  // namespace frc971::vision
diff --git a/y2020/vision/camera_reader_main.cc b/y2020/vision/camera_reader_main.cc
index b54cf4e..1995151 100644
--- a/y2020/vision/camera_reader_main.cc
+++ b/y2020/vision/camera_reader_main.cc
@@ -6,8 +6,8 @@
 // bazel run //y2020/vision:camera_reader -- --config y2020/aos_config.json
 //   --override_hostname pi-7971-1  --ignore_timestamps true
 DEFINE_string(config, "aos_config.json", "Path to the config file to use.");
-namespace frc971 {
-namespace vision {
+
+namespace frc971::vision {
 namespace {
 
 void CameraReaderMain() {
@@ -43,8 +43,7 @@
 }
 
 }  // namespace
-}  // namespace vision
-}  // namespace frc971
+}  // namespace frc971::vision
 
 int main(int argc, char **argv) {
   aos::InitGoogle(&argc, &argv);
diff --git a/y2020/vision/extrinsics_calibration.cc b/y2020/vision/extrinsics_calibration.cc
index 334de0b..deda8c3 100644
--- a/y2020/vision/extrinsics_calibration.cc
+++ b/y2020/vision/extrinsics_calibration.cc
@@ -21,8 +21,7 @@
 DEFINE_string(base_intrinsics, "",
               "Intrinsics to use for extrinsics calibration.");
 
-namespace frc971 {
-namespace vision {
+namespace frc971::vision {
 namespace chrono = std::chrono;
 using aos::distributed_clock;
 using aos::monotonic_clock;
@@ -146,8 +145,7 @@
   }
 }
 
-}  // namespace vision
-}  // namespace frc971
+}  // namespace frc971::vision
 
 int main(int argc, char **argv) {
   aos::InitGoogle(&argc, &argv);
diff --git a/y2020/vision/sift/fast_gaussian.cc b/y2020/vision/sift/fast_gaussian.cc
index 22549ac..69432b4 100644
--- a/y2020/vision/sift/fast_gaussian.cc
+++ b/y2020/vision/sift/fast_gaussian.cc
@@ -6,8 +6,7 @@
 
 #include "y2020/vision/sift/fast_gaussian_all.h"
 
-namespace frc971 {
-namespace vision {
+namespace frc971::vision {
 namespace {
 
 void CheckNonOverlapping(const cv::Mat &a, const cv::Mat &b) {
@@ -122,5 +121,4 @@
   cv::subtract(*blurred, source, *difference);
 }
 
-}  // namespace vision
-}  // namespace frc971
+}  // namespace frc971::vision
diff --git a/y2020/vision/sift/fast_gaussian_generator.cc b/y2020/vision/sift/fast_gaussian_generator.cc
index aefb3d9..9b3ca9a 100644
--- a/y2020/vision/sift/fast_gaussian_generator.cc
+++ b/y2020/vision/sift/fast_gaussian_generator.cc
@@ -15,8 +15,7 @@
 // https://halide-lang.org/tutorials/tutorial_lesson_15_generators.html has an
 // introduction to much of the magic in this file.
 
-namespace frc971 {
-namespace vision {
+namespace frc971::vision {
 namespace {
 
 // Returns a function implementating a 1-dimensional gaussian blur convolution.
@@ -206,8 +205,7 @@
   }
 };
 
-}  // namespace vision
-}  // namespace frc971
+}  // namespace frc971::vision
 
 HALIDE_REGISTER_GENERATOR(frc971::vision::GaussianGenerator, gaussian_generator)
 HALIDE_REGISTER_GENERATOR(frc971::vision::SubtractGenerator, subtract_generator)
diff --git a/y2020/vision/sift/fast_gaussian_test.cc b/y2020/vision/sift/fast_gaussian_test.cc
index 0ed9e20..27bab54 100644
--- a/y2020/vision/sift/fast_gaussian_test.cc
+++ b/y2020/vision/sift/fast_gaussian_test.cc
@@ -5,9 +5,7 @@
 
 #include "y2020/vision/sift/fast_gaussian_all.h"
 
-namespace frc971 {
-namespace vision {
-namespace testing {
+namespace frc971::vision::testing {
 
 class FastGaussianTest : public ::testing::Test {
  public:
@@ -70,6 +68,4 @@
   ExpectEqual(fast, fast_direct, 0);
 }
 
-}  // namespace testing
-}  // namespace vision
-}  // namespace frc971
+}  // namespace frc971::vision::testing
diff --git a/y2020/vision/sift/get_gaussian_kernel_test.cc b/y2020/vision/sift/get_gaussian_kernel_test.cc
index e35f06e..3d2674f 100644
--- a/y2020/vision/sift/get_gaussian_kernel_test.cc
+++ b/y2020/vision/sift/get_gaussian_kernel_test.cc
@@ -8,9 +8,7 @@
 #include <opencv2/core/mat.hpp>
 #include <opencv2/imgproc.hpp>
 
-namespace frc971 {
-namespace vision {
-namespace testing {
+namespace frc971::vision::testing {
 
 class GetGaussianKernelTest
     : public ::testing::TestWithParam<std::tuple<int, double>> {
@@ -33,6 +31,4 @@
                                             ::testing::Values(0.01f, 0.1f,
                                                               0.9f)));
 
-}  // namespace testing
-}  // namespace vision
-}  // namespace frc971
+}  // namespace frc971::vision::testing
diff --git a/y2020/vision/sift/sift971.cc b/y2020/vision/sift/sift971.cc
index afab9b4..21f9a97 100644
--- a/y2020/vision/sift/sift971.cc
+++ b/y2020/vision/sift/sift971.cc
@@ -118,8 +118,7 @@
 
 using namespace cv;
 
-namespace frc971 {
-namespace vision {
+namespace frc971::vision {
 namespace {
 
 #define USE_AVX2 0
@@ -1288,5 +1287,4 @@
   }
 }
 
-}  // namespace vision
-}  // namespace frc971
+}  // namespace frc971::vision
diff --git a/y2020/vision/tools/python_code/camera_param_test.cc b/y2020/vision/tools/python_code/camera_param_test.cc
index 30616b0..f47c327 100644
--- a/y2020/vision/tools/python_code/camera_param_test.cc
+++ b/y2020/vision/tools/python_code/camera_param_test.cc
@@ -16,8 +16,7 @@
 #include "y2020/vision/sift/sift_generated.h"
 #include "y2020/vision/sift/sift_training_generated.h"
 
-namespace frc971 {
-namespace vision {
+namespace frc971::vision {
 namespace {
 
 class Feature {
@@ -275,5 +274,4 @@
 }
 
 }  // namespace
-}  // namespace vision
-}  // namespace frc971
+}  // namespace frc971::vision
diff --git a/y2020/vision/viewer.cc b/y2020/vision/viewer.cc
index ff08f01..8ba2955 100644
--- a/y2020/vision/viewer.cc
+++ b/y2020/vision/viewer.cc
@@ -20,8 +20,7 @@
 DEFINE_string(capture, "",
               "If set, capture a single image and save it to this filename.");
 
-namespace frc971 {
-namespace vision {
+namespace frc971::vision {
 namespace {
 
 aos::Fetcher<CameraImage> image_fetcher;
@@ -170,8 +169,7 @@
 }
 
 }  // namespace
-}  // namespace vision
-}  // namespace frc971
+}  // namespace frc971::vision
 
 // Quick and lightweight grayscale viewer for images
 int main(int argc, char **argv) {
diff --git a/y2020/vision/viewer_replay.cc b/y2020/vision/viewer_replay.cc
index 03777bc..ee1c8d5 100644
--- a/y2020/vision/viewer_replay.cc
+++ b/y2020/vision/viewer_replay.cc
@@ -12,8 +12,7 @@
 DEFINE_string(image_save_prefix, "/tmp/img",
               "Prefix to use for saving images from the logfile.");
 
-namespace frc971 {
-namespace vision {
+namespace frc971::vision {
 namespace {
 
 void ViewerMain(int argc, char *argv[]) {
@@ -50,8 +49,7 @@
 }
 
 }  // namespace
-}  // namespace vision
-}  // namespace frc971
+}  // namespace frc971::vision
 
 // Quick and lightweight grayscale viewer for images
 int main(int argc, char **argv) {
diff --git a/y2020/wpilib_interface.cc b/y2020/wpilib_interface.cc
index c9cec8a..f3ff00f 100644
--- a/y2020/wpilib_interface.cc
+++ b/y2020/wpilib_interface.cc
@@ -65,8 +65,7 @@
 namespace chrono = ::std::chrono;
 using std::make_unique;
 
-namespace y2020 {
-namespace wpilib {
+namespace y2020::wpilib {
 namespace {
 
 constexpr double kMaxBringupPower = 12.0;
@@ -685,7 +684,6 @@
   }
 };
 
-}  // namespace wpilib
-}  // namespace y2020
+}  // namespace y2020::wpilib
 
 AOS_ROBOT_CLASS(::y2020::wpilib::WPILibRobot);