buffet: remove unnecessary NOLINTs and restored some C++11 code

The old cpplint was issuing a lot of false-positives for new C++11
features and I had to either explicitly disable the warning or
work around them (e.g. instead of using uniform initialization,
I used a normal constructor syntax with initializer list inside).

These redundancies are no longer needed since the linter has been
updated.

Also removed some of auto&& from loops because the new
cpplint complains about RValue references.

BUG=None
TEST=Unit tests still pass.

Change-Id: Ibe9538e3e1cb793be807a23e82627444e663934c
Reviewed-on: https://chromium-review.googlesource.com/203797
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/buffet/any_unittest.cc b/buffet/any_unittest.cc
index 48df826..eaf3ce1 100644
--- a/buffet/any_unittest.cc
+++ b/buffet/any_unittest.cc
@@ -73,7 +73,7 @@
   val2.Clear();
   EXPECT_TRUE(val2.IsEmpty());
 
-  val = std::vector<int>({100, 20, 3});
+  val = std::vector<int>{100, 20, 3};
   auto v = val.Get<std::vector<int>>();
   EXPECT_EQ(100, v[0]);
   EXPECT_EQ(20, v[1]);
@@ -197,7 +197,7 @@
     std::string name;
     int age;
   };
-  Any val(Person{"Jack", 40});  // NOLINT(whitespace/braces)
+  Any val(Person{"Jack", 40});
   Any val2 = val;
   EXPECT_EQ("Jack", val.Get<Person>().name);
   val.GetPtr<Person>()->name = "Joe";
diff --git a/buffet/async_event_sequencer.cc b/buffet/async_event_sequencer.cc
index 1dca62c..b90b552 100644
--- a/buffet/async_event_sequencer.cc
+++ b/buffet/async_event_sequencer.cc
@@ -99,7 +99,7 @@
     // be scheduled in the future.
     return;
   }
-  for (auto&& completion_action : completion_actions_) {
+  for (const auto& completion_action : completion_actions_) {
     // Should this be put on the message loop or run directly?
     completion_action.Run(!had_failures_);
   }
diff --git a/buffet/async_event_sequencer.h b/buffet/async_event_sequencer.h
index 96adad7..c16325b 100644
--- a/buffet/async_event_sequencer.h
+++ b/buffet/async_event_sequencer.h
@@ -87,11 +87,11 @@
                        const std::string& error_message);
   void PossiblyRunCompletionActions();
 
-  bool started_{false};          // NOLINT - initializer list
-  int registration_counter_{0};  // NOLINT - initializer list
+  bool started_{false};
+  int registration_counter_{0};
   std::set<int> outstanding_registrations_;
   std::vector<CompletionAction> completion_actions_;
-  bool had_failures_{false};     // NOLINT - initializer list
+  bool had_failures_{false};
   // Ref counted objects have private destructors.
   ~AsyncEventSequencer();
   friend class base::RefCounted<AsyncEventSequencer>;
diff --git a/buffet/buffet_client.cc b/buffet/buffet_client.cc
index a763e42..11f4ffc 100644
--- a/buffet/buffet_client.cc
+++ b/buffet/buffet_client.cc
@@ -136,7 +136,7 @@
 
     if (!args.empty()) {
       auto key_values = buffet::data_encoding::WebParamsDecode(args.front());
-      for (auto&& pair : key_values) {
+      for (const auto& pair : key_values) {
         params.insert(std::make_pair(
           pair.first, std::shared_ptr<base::Value>(
               base::Value::CreateStringValue(pair.second))));
@@ -148,7 +148,7 @@
     dbus::MessageWriter writer(&method_call);
     dbus::MessageWriter dict_writer(nullptr);
     writer.OpenArray("{sv}", &dict_writer);
-    for (auto&& pair : params) {
+    for (const auto& pair : params) {
       dbus::MessageWriter dict_entry_writer(nullptr);
       dict_writer.OpenDictEntry(&dict_entry_writer);
       dict_entry_writer.AppendString(pair.first);
@@ -252,8 +252,8 @@
 
  private:
   scoped_refptr<dbus::Bus> bus_;
-  dbus::ObjectProxy* manager_proxy_{nullptr};  // NOLINT - initializer list
-  dbus::ObjectProxy* root_proxy_{nullptr};  // NOLINT - initializer list
+  dbus::ObjectProxy* manager_proxy_{nullptr};
+  dbus::ObjectProxy* root_proxy_{nullptr};
 };
 
 }  // namespace
diff --git a/buffet/data_encoding.cc b/buffet/data_encoding.cc
index 9f351de..f2de937 100644
--- a/buffet/data_encoding.cc
+++ b/buffet/data_encoding.cc
@@ -77,7 +77,7 @@
                             bool encodeSpaceAsPlus) {
   std::vector<std::string> pairs;
   pairs.reserve(params.size());
-  for (auto&& p : params) {
+  for (const auto& p : params) {
     std::string key = UrlEncode(p.first.c_str(), encodeSpaceAsPlus);
     std::string value = UrlEncode(p.second.c_str(), encodeSpaceAsPlus);
     pairs.push_back(string_utils::Join('=', key, value));
@@ -89,7 +89,7 @@
 WebParamList WebParamsDecode(const std::string& data) {
   WebParamList result;
   std::vector<std::string> params = string_utils::Split(data, '&');
-  for (auto p : params) {
+  for (const auto& p : params) {
     auto pair = string_utils::SplitAtFirst(p, '=');
     result.emplace_back(UrlDecode(pair.first.c_str()),
                         UrlDecode(pair.second.c_str()));
diff --git a/buffet/exported_property_set.h b/buffet/exported_property_set.h
index 405ed7d..d91415f 100644
--- a/buffet/exported_property_set.h
+++ b/buffet/exported_property_set.h
@@ -173,7 +173,7 @@
 
  private:
   OnUpdateCallback on_update_;
-  T value_{};  // NOLINT - initializer list
+  T value_{};
 
   DISALLOW_COPY_AND_ASSIGN(ExportedProperty);
 };
diff --git a/buffet/http_utils_unittest.cc b/buffet/http_utils_unittest.cc
index 404ef7b..882752b 100644
--- a/buffet/http_utils_unittest.cc
+++ b/buffet/http_utils_unittest.cc
@@ -59,7 +59,7 @@
   transport->AddHandler(kMethodEchoUrl, "*", base::Bind(EchoMethodHandler));
 
   // Test binary data round-tripping.
-  std::vector<unsigned char> custom_data({0xFF, 0x00, 0x80, 0x40, 0xC0, 0x7F});
+  std::vector<unsigned char> custom_data{0xFF, 0x00, 0x80, 0x40, 0xC0, 0x7F};
 
   // Check the correct HTTP method used.
   auto response = http::SendRequest(request_type::kPost, kMethodEchoUrl,
diff --git a/buffet/map_utils.h b/buffet/map_utils.h
index 87d8d37..f5e3f30 100644
--- a/buffet/map_utils.h
+++ b/buffet/map_utils.h
@@ -16,7 +16,7 @@
 std::vector<typename T::key_type> GetMapKeys(const T& map) {
   std::vector<typename T::key_type> keys;
   keys.reserve(map.size());
-  for (auto&& pair : map)
+  for (const auto& pair : map)
     keys.push_back(pair.first);
   return keys;
 }
@@ -26,7 +26,7 @@
 std::vector<typename T::mapped_type> GetMapValues(const T& map) {
   std::vector<typename T::mapped_type> values;
   values.reserve(map.size());
-  for (auto&& pair : map)
+  for (const auto& pair : map)
     values.push_back(pair.second);
   return values;
 }
@@ -37,7 +37,7 @@
                       typename T::mapped_type>> MapToVector(const T& map) {
   std::vector<std::pair<typename T::key_type, typename T::mapped_type>> vector;
   vector.reserve(map.size());
-  for (auto&& pair : map)
+  for (const auto& pair : map)
     vector.push_back(pair);
   return vector;
 }
diff --git a/buffet/mime_utils.cc b/buffet/mime_utils.cc
index ca221dc..dc57497 100644
--- a/buffet/mime_utils.cc
+++ b/buffet/mime_utils.cc
@@ -102,7 +102,7 @@
                           const mime::Parameters& parameters) {
   std::vector<std::string> parts;
   parts.push_back(string_utils::Join('/', type, subtype));
-  for (auto&& pair : parameters) {
+  for (const auto& pair : parameters) {
     parts.push_back(string_utils::Join('=', pair.first,
                                        EncodeParam(pair.second)));
   }
@@ -146,7 +146,7 @@
 std::string mime::GetParameterValue(const std::string& mime_string,
                                     const std::string& paramName) {
   mime::Parameters params = mime::GetParameters(mime_string);
-  for (auto&& pair : params) {
+  for (const auto& pair : params) {
     if (base::strcasecmp(pair.first.c_str(), paramName.c_str()) == 0)
       return pair.second;
   }
diff --git a/buffet/url_utils.cc b/buffet/url_utils.cc
index 0395094..3fcdb48 100644
--- a/buffet/url_utils.cc
+++ b/buffet/url_utils.cc
@@ -71,7 +71,7 @@
   std::string result = url;
   if (!parts.empty()) {
     std::string query_string = TrimOffQueryString(&result);
-    for (auto&& part : parts) {
+    for (const auto& part : parts) {
       if (!part.empty()) {
         if (!result.empty() && result.back() != '/')
           result += '/';
@@ -112,7 +112,7 @@
 std::string url::GetQueryStringValue(
     const data_encoding::WebParamList& params,
     const std::string& name) {
-  for (auto&& pair : params) {
+  for (const auto& pair : params) {
     if (name.compare(pair.first) == 0)
       return pair.second;
   }