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/y2022/actors/auto_splines.cc b/y2022/actors/auto_splines.cc
index e674dc4..b0915d5 100644
--- a/y2022/actors/auto_splines.cc
+++ b/y2022/actors/auto_splines.cc
@@ -2,8 +2,7 @@
 
 #include "frc971/control_loops/control_loops_generated.h"
 
-namespace y2022 {
-namespace actors {
+namespace y2022::actors {
 
 void MaybeFlipSpline(
     aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder,
@@ -100,5 +99,4 @@
       alliance);
 }
 
-}  // namespace actors
-}  // namespace y2022
+}  // namespace y2022::actors
diff --git a/y2022/actors/autonomous_actor.cc b/y2022/actors/autonomous_actor.cc
index 19e9edf..41f7e04 100644
--- a/y2022/actors/autonomous_actor.cc
+++ b/y2022/actors/autonomous_actor.cc
@@ -18,8 +18,7 @@
 DEFINE_bool(rapid_react_two, false,
             "If true, run the two ball rapid react autonomous mode");
 
-namespace y2022 {
-namespace actors {
+namespace y2022::actors {
 namespace {
 constexpr double kExtendIntakeGoal = -0.10;
 constexpr double kRetractIntakeGoal = 1.47;
@@ -491,5 +490,4 @@
   }
 }
 
-}  // namespace actors
-}  // namespace y2022
+}  // namespace y2022::actors
diff --git a/y2022/constants.cc b/y2022/constants.cc
index 04ca14c..7ad6213 100644
--- a/y2022/constants.cc
+++ b/y2022/constants.cc
@@ -19,8 +19,7 @@
 #include "y2022/control_loops/superstructure/intake/integral_intake_plant.h"
 #include "y2022/control_loops/superstructure/turret/integral_turret_plant.h"
 
-namespace y2022 {
-namespace constants {
+namespace y2022::constants {
 
 const int Values::kZeroingSampleSize;
 
@@ -412,5 +411,4 @@
 
 Values MakeValues() { return MakeValues(aos::network::GetTeamNumber()); }
 
-}  // namespace constants
-}  // namespace y2022
+}  // namespace y2022::constants
diff --git a/y2022/control_loops/drivetrain/drivetrain_base.cc b/y2022/control_loops/drivetrain/drivetrain_base.cc
index c58353e..551a5d5 100644
--- a/y2022/control_loops/drivetrain/drivetrain_base.cc
+++ b/y2022/control_loops/drivetrain/drivetrain_base.cc
@@ -14,9 +14,7 @@
 
 namespace chrono = ::std::chrono;
 
-namespace y2022 {
-namespace control_loops {
-namespace drivetrain {
+namespace y2022::control_loops::drivetrain {
 
 using ::frc971::constants::ShifterHallEffect;
 
@@ -66,6 +64,4 @@
   return kDrivetrainConfig;
 };
 
-}  // namespace drivetrain
-}  // namespace control_loops
-}  // namespace y2022
+}  // namespace y2022::control_loops::drivetrain
diff --git a/y2022/control_loops/superstructure/catapult/catapult.cc b/y2022/control_loops/superstructure/catapult/catapult.cc
index b0ec6fd..493bb46 100644
--- a/y2022/control_loops/superstructure/catapult/catapult.cc
+++ b/y2022/control_loops/superstructure/catapult/catapult.cc
@@ -10,10 +10,7 @@
 #include "osqp.h"
 #include "y2022/control_loops/superstructure/catapult/catapult_plant.h"
 
-namespace y2022 {
-namespace control_loops {
-namespace superstructure {
-namespace catapult {
+namespace y2022::control_loops::superstructure::catapult {
 namespace chrono = std::chrono;
 
 namespace {
@@ -453,7 +450,4 @@
   return catapult_.MakeStatus(fbb);
 }
 
-}  // namespace catapult
-}  // namespace superstructure
-}  // namespace control_loops
-}  // namespace y2022
+}  // namespace y2022::control_loops::superstructure::catapult
diff --git a/y2022/control_loops/superstructure/catapult/catapult_main.cc b/y2022/control_loops/superstructure/catapult/catapult_main.cc
index 53d357a..e3f897c 100644
--- a/y2022/control_loops/superstructure/catapult/catapult_main.cc
+++ b/y2022/control_loops/superstructure/catapult/catapult_main.cc
@@ -4,10 +4,7 @@
 #include "y2022/control_loops/superstructure/catapult/catapult.h"
 #include "y2022/control_loops/superstructure/catapult/catapult_plant.h"
 
-namespace y2022 {
-namespace control_loops {
-namespace superstructure {
-namespace catapult {
+namespace y2022::control_loops::superstructure::catapult {
 namespace chrono = std::chrono;
 
 void OSQPSolve() {
@@ -114,10 +111,7 @@
   return 0;
 }
 
-}  // namespace catapult
-}  // namespace superstructure
-}  // namespace control_loops
-}  // namespace y2022
+}  // namespace y2022::control_loops::superstructure::catapult
 
 int main(int argc, char **argv) {
   ::aos::InitGoogle(&argc, &argv);
diff --git a/y2022/control_loops/superstructure/catapult/catapult_test.cc b/y2022/control_loops/superstructure/catapult/catapult_test.cc
index 7361bcd..b2cd180 100644
--- a/y2022/control_loops/superstructure/catapult/catapult_test.cc
+++ b/y2022/control_loops/superstructure/catapult/catapult_test.cc
@@ -5,11 +5,7 @@
 
 #include "y2022/control_loops/superstructure/catapult/catapult_plant.h"
 
-namespace y2022 {
-namespace control_loops {
-namespace superstructure {
-namespace catapult {
-namespace testing {
+namespace y2022::control_loops::superstructure::catapult::testing {
 
 // Tests that computing P and q with 2 different horizons comes out the same.
 TEST(MPCTest, HorizonTest) {
@@ -56,8 +52,4 @@
   EXPECT_NEAR(X_final.y(), X.y(), 1e-2);
 }
 
-}  // namespace testing
-}  // namespace catapult
-}  // namespace superstructure
-}  // namespace control_loops
-}  // namespace y2022
+}  // namespace y2022::control_loops::superstructure::catapult::testing
diff --git a/y2022/control_loops/superstructure/collision_avoidance.cc b/y2022/control_loops/superstructure/collision_avoidance.cc
index 0c13295..33e4d6e 100644
--- a/y2022/control_loops/superstructure/collision_avoidance.cc
+++ b/y2022/control_loops/superstructure/collision_avoidance.cc
@@ -5,9 +5,7 @@
 #include "absl/functional/bind_front.h"
 #include "glog/logging.h"
 
-namespace y2022 {
-namespace control_loops {
-namespace superstructure {
+namespace y2022::control_loops::superstructure {
 
 CollisionAvoidance::CollisionAvoidance() {
   clear_min_intake_front_goal();
@@ -213,6 +211,4 @@
   }
 }
 
-}  // namespace superstructure
-}  // namespace control_loops
-}  // namespace y2022
+}  // namespace y2022::control_loops::superstructure
diff --git a/y2022/control_loops/superstructure/superstructure.cc b/y2022/control_loops/superstructure/superstructure.cc
index 5abe995..fc6aeee 100644
--- a/y2022/control_loops/superstructure/superstructure.cc
+++ b/y2022/control_loops/superstructure/superstructure.cc
@@ -9,9 +9,7 @@
 DEFINE_bool(ignore_distance, false,
             "If true, ignore distance when shooting and obay joystick_reader");
 
-namespace y2022 {
-namespace control_loops {
-namespace superstructure {
+namespace y2022::control_loops::superstructure {
 
 using frc971::control_loops::AbsoluteEncoderProfiledJointStatus;
 using frc971::control_loops::PotAndAbsoluteEncoderProfiledJointStatus;
@@ -653,6 +651,4 @@
               : 0.0);
 }
 
-}  // namespace superstructure
-}  // namespace control_loops
-}  // namespace y2022
+}  // namespace y2022::control_loops::superstructure
diff --git a/y2022/control_loops/superstructure/superstructure_lib_test.cc b/y2022/control_loops/superstructure/superstructure_lib_test.cc
index c85d5d0..cbe3c97 100644
--- a/y2022/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2022/control_loops/superstructure/superstructure_lib_test.cc
@@ -19,10 +19,7 @@
 DEFINE_string(output_folder, "",
               "If set, logs all channels to the provided logfile.");
 
-namespace y2022 {
-namespace control_loops {
-namespace superstructure {
-namespace testing {
+namespace y2022::control_loops::superstructure::testing {
 namespace chrono = std::chrono;
 
 using ::aos::monotonic_clock;
@@ -1300,7 +1297,4 @@
               superstructure_status_fetcher_->turret()->position(), 5e-4);
 }
 
-}  // namespace testing
-}  // namespace superstructure
-}  // namespace control_loops
-}  // namespace y2022
+}  // namespace y2022::control_loops::superstructure::testing
diff --git a/y2022/control_loops/superstructure/turret/aiming.cc b/y2022/control_loops/superstructure/turret/aiming.cc
index c570856..18ebafa 100644
--- a/y2022/control_loops/superstructure/turret/aiming.cc
+++ b/y2022/control_loops/superstructure/turret/aiming.cc
@@ -2,10 +2,7 @@
 
 #include "y2022/control_loops/drivetrain/drivetrain_base.h"
 
-namespace y2022 {
-namespace control_loops {
-namespace superstructure {
-namespace turret {
+namespace y2022::control_loops::superstructure::turret {
 
 using frc971::control_loops::Pose;
 using frc971::control_loops::aiming::RobotState;
@@ -80,7 +77,4 @@
   return builder.Finish();
 }
 
-}  // namespace turret
-}  // namespace superstructure
-}  // namespace control_loops
-}  // namespace y2022
+}  // namespace y2022::control_loops::superstructure::turret
diff --git a/y2022/joystick_reader.cc b/y2022/joystick_reader.cc
index 910e16d..9993e8f 100644
--- a/y2022/joystick_reader.cc
+++ b/y2022/joystick_reader.cc
@@ -31,9 +31,7 @@
 using frc971::input::driver_station::JoystickAxis;
 using frc971::input::driver_station::POVLocation;
 
-namespace y2022 {
-namespace input {
-namespace joysticks {
+namespace y2022::input::joysticks {
 
 namespace superstructure = y2022::control_loops::superstructure;
 
@@ -376,9 +374,7 @@
   bool last_back_intake_has_ball_ = false;
 };
 
-}  // namespace joysticks
-}  // namespace input
-}  // namespace y2022
+}  // namespace y2022::input::joysticks
 
 int main(int argc, char **argv) {
   ::aos::InitGoogle(&argc, &argv);
diff --git a/y2022/vision/ball_color.cc b/y2022/vision/ball_color.cc
index b1ebd85..930142f 100644
--- a/y2022/vision/ball_color.cc
+++ b/y2022/vision/ball_color.cc
@@ -13,8 +13,7 @@
 #include "frc971/input/joystick_state_generated.h"
 #include "frc971/vision/vision_generated.h"
 
-namespace y2022 {
-namespace vision {
+namespace y2022::vision {
 
 namespace {
 cv::Rect ArrayToRect(const std::array<int, 4> &values) {
@@ -144,5 +143,4 @@
   return sum / num_pixels_selected;
 }
 
-}  // namespace vision
-}  // namespace y2022
+}  // namespace y2022::vision
diff --git a/y2022/vision/ball_color_main.cc b/y2022/vision/ball_color_main.cc
index 03e3033..5f05b34 100644
--- a/y2022/vision/ball_color_main.cc
+++ b/y2022/vision/ball_color_main.cc
@@ -9,8 +9,7 @@
 //   --override_hostname pi-7971-1  --ignore_timestamps true
 DEFINE_string(config, "aos_config.json", "Path to the config file to use.");
 
-namespace y2022 {
-namespace vision {
+namespace y2022::vision {
 namespace {
 
 using namespace frc971::vision;
@@ -28,8 +27,7 @@
 }
 
 }  // namespace
-}  // namespace vision
-}  // namespace y2022
+}  // namespace y2022::vision
 
 int main(int argc, char **argv) {
   aos::InitGoogle(&argc, &argv);
diff --git a/y2022/vision/blob_detector.cc b/y2022/vision/blob_detector.cc
index 2c6ff44..70ff1b2 100644
--- a/y2022/vision/blob_detector.cc
+++ b/y2022/vision/blob_detector.cc
@@ -25,8 +25,7 @@
              "Required difference between green pixels vs. blue when using "
              "--use_outdoors");
 
-namespace y2022 {
-namespace vision {
+namespace y2022::vision {
 
 cv::Mat BlobDetector::ThresholdImage(cv::Mat bgr_image) {
   cv::Mat binarized_image(cv::Size(bgr_image.cols, bgr_image.rows), CV_8UC1);
@@ -266,5 +265,4 @@
           << " ms";
 }
 
-}  // namespace vision
-}  // namespace y2022
+}  // namespace y2022::vision
diff --git a/y2022/vision/calibrate_extrinsics.cc b/y2022/vision/calibrate_extrinsics.cc
index d8b57dc..0a950ab 100644
--- a/y2022/vision/calibrate_extrinsics.cc
+++ b/y2022/vision/calibrate_extrinsics.cc
@@ -25,8 +25,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;
@@ -263,8 +262,7 @@
   }
 }  // namespace vision
 
-}  // namespace vision
-}  // namespace frc971
+}  // namespace frc971::vision
 
 int main(int argc, char **argv) {
   aos::InitGoogle(&argc, &argv);
diff --git a/y2022/vision/camera_reader.cc b/y2022/vision/camera_reader.cc
index 012a2db..a077d09 100644
--- a/y2022/vision/camera_reader.cc
+++ b/y2022/vision/camera_reader.cc
@@ -17,8 +17,7 @@
 
 DEFINE_string(image_png, "", "A set of PNG images");
 
-namespace y2022 {
-namespace vision {
+namespace y2022::vision {
 
 using namespace frc971::vision;
 
@@ -235,5 +234,4 @@
   }
 }
 
-}  // namespace vision
-}  // namespace y2022
+}  // namespace y2022::vision
diff --git a/y2022/vision/camera_reader_main.cc b/y2022/vision/camera_reader_main.cc
index 5f19d64..278f14b 100644
--- a/y2022/vision/camera_reader_main.cc
+++ b/y2022/vision/camera_reader_main.cc
@@ -14,8 +14,7 @@
               "Exposure time when using --use_outdoors, in 100us increments; 0 "
               "implies auto exposure");
 
-namespace y2022 {
-namespace vision {
+namespace y2022::vision {
 namespace {
 
 using namespace frc971::vision;
@@ -59,8 +58,7 @@
 }
 
 }  // namespace
-}  // namespace vision
-}  // namespace y2022
+}  // namespace y2022::vision
 
 int main(int argc, char **argv) {
   aos::InitGoogle(&argc, &argv);
diff --git a/y2022/vision/viewer.cc b/y2022/vision/viewer.cc
index 58db722..b0bcdac 100644
--- a/y2022/vision/viewer.cc
+++ b/y2022/vision/viewer.cc
@@ -36,8 +36,7 @@
             "If true, display the target estimation graphically");
 DEFINE_bool(sort_by_time, true, "If true, sort the images by time");
 
-namespace y2022 {
-namespace vision {
+namespace y2022::vision {
 namespace {
 
 using namespace frc971::vision;
@@ -273,8 +272,7 @@
   }
 }
 }  // namespace
-}  // namespace vision
-}  // namespace y2022
+}  // namespace y2022::vision
 
 // Quick and lightweight viewer for images
 int main(int argc, char **argv) {
diff --git a/y2022/vision/viewer_replay.cc b/y2022/vision/viewer_replay.cc
index 7e8c800..15427e4 100644
--- a/y2022/vision/viewer_replay.cc
+++ b/y2022/vision/viewer_replay.cc
@@ -26,8 +26,7 @@
 DEFINE_string(logger_pi_log, "/tmp/logger_pi/", "Path to logger pi log");
 DEFINE_string(roborio_log, "/tmp/roborio/", "Path to roborio log");
 
-namespace y2022 {
-namespace vision {
+namespace y2022::vision {
 namespace {
 
 using aos::monotonic_clock;
@@ -257,8 +256,7 @@
 }
 
 }  // namespace
-}  // namespace vision
-}  // namespace y2022
+}  // namespace y2022::vision
 
 // Quick and lightweight viewer for image logs
 int main(int argc, char **argv) {
diff --git a/y2022/wpilib_interface.cc b/y2022/wpilib_interface.cc
index 55cf510..dd2224c 100644
--- a/y2022/wpilib_interface.cc
+++ b/y2022/wpilib_interface.cc
@@ -65,8 +65,7 @@
 
 DEFINE_bool(can_catapult, false, "If true, use CAN to control the catapult.");
 
-namespace y2022 {
-namespace wpilib {
+namespace y2022::wpilib {
 namespace {
 
 constexpr double kMaxBringupPower = 12.0;
@@ -828,7 +827,6 @@
   }
 };
 
-}  // namespace wpilib
-}  // namespace y2022
+}  // namespace y2022::wpilib
 
 AOS_ROBOT_CLASS(::y2022::wpilib::WPILibRobot);