diff options
author | Chih-Hung Hsieh <chh@google.com> | 2016-06-29 16:07:18 -0700 |
---|---|---|
committer | Chih-Hung Hsieh <chh@google.com> | 2016-06-29 16:07:18 -0700 |
commit | 253b5b6d35d47ed6b58b0ca1042b7455b0e2fdb2 (patch) | |
tree | 899708cc8eb5cd7421d17aec16fbecee63413e16 | |
parent | a623740c7ecf7d84cf6787c8fc9cb488ae198952 (diff) | |
download | platform_external_libbrillo-253b5b6d35d47ed6b58b0ca1042b7455b0e2fdb2.tar.gz platform_external_libbrillo-253b5b6d35d47ed6b58b0ca1042b7455b0e2fdb2.tar.bz2 platform_external_libbrillo-253b5b6d35d47ed6b58b0ca1042b7455b0e2fdb2.zip |
Fix clang-tidy warnings in libbrilloandroid-wear-n-preview-2android-wear-7.1.1_r1android-n-preview-5android-n-iot-preview-2nougat-mr1-wear-releasen-iot-preview-2
* Add explicit qualifier to constructors taking a single argument.
* Add NOLINT to implicit conversion constructors.
Bug: 28341362
Change-Id: Id4066ae8877b4fa8597fefde5aa43880f2afcdd0
Test: build with clang-tidy
-rw-r--r-- | brillo/any_internal_impl.h | 3 | ||||
-rw-r--r-- | brillo/bind_lambda.h | 4 | ||||
-rw-r--r-- | brillo/dbus/dbus_object_internal_impl.h | 2 | ||||
-rw-r--r-- | brillo/http/http_form_data.h | 2 |
4 files changed, 6 insertions, 5 deletions
diff --git a/brillo/any_internal_impl.h b/brillo/any_internal_impl.h index 0154d4d..9309f5d 100644 --- a/brillo/any_internal_impl.h +++ b/brillo/any_internal_impl.h @@ -69,7 +69,8 @@ struct IsEqualityComparableHelper { // IntWrapper when both overloads are provided. // Also this constructor must NOT be explicit. // NOLINTNEXTLINE(runtime/explicit) - IntWrapper(int /* dummy */) {} // do nothing + // NOLINT: Allow implicit conversion from int. + IntWrapper(int /* dummy */) {} // do nothing, NOLINT }; // Here is an obscure trick to determine if a type U has operator==(). diff --git a/brillo/bind_lambda.h b/brillo/bind_lambda.h index 18c3212..50ac095 100644 --- a/brillo/bind_lambda.h +++ b/brillo/bind_lambda.h @@ -30,7 +30,7 @@ template <typename Lambda, typename R, typename... Args> class LambdaAdapter<Lambda, R(Lambda::*)(Args... args)> { public: typedef R(RunType)(Args...); - LambdaAdapter(Lambda lambda) : lambda_(lambda) {} + explicit LambdaAdapter(Lambda lambda) : lambda_(lambda) {} R Run(Args... args) { return lambda_(std::forward<Args>(args)...); } private: @@ -42,7 +42,7 @@ template <typename Lambda, typename R, typename... Args> class LambdaAdapter<Lambda, R(Lambda::*)(Args... args) const> { public: typedef R(RunType)(Args...); - LambdaAdapter(Lambda lambda) : lambda_(lambda) {} + explicit LambdaAdapter(Lambda lambda) : lambda_(lambda) {} R Run(Args... args) { return lambda_(std::forward<Args>(args)...); } private: diff --git a/brillo/dbus/dbus_object_internal_impl.h b/brillo/dbus/dbus_object_internal_impl.h index 5f174d4..3c5e8d7 100644 --- a/brillo/dbus/dbus_object_internal_impl.h +++ b/brillo/dbus/dbus_object_internal_impl.h @@ -341,7 +341,7 @@ class RawDBusInterfaceMethodHandler public: // A constructor that takes a |handler| to be called when HandleMethod() // virtual function is invoked. - RawDBusInterfaceMethodHandler( + explicit RawDBusInterfaceMethodHandler( const base::Callback<void(dbus::MethodCall*, ResponseSender)>& handler) : handler_(handler) {} diff --git a/brillo/http/http_form_data.h b/brillo/http/http_form_data.h index 55ec150..e12d3d8 100644 --- a/brillo/http/http_form_data.h +++ b/brillo/http/http_form_data.h @@ -155,7 +155,7 @@ class BRILLO_EXPORT MultiPartFormField : public FormField { // content_type: valid content type. If omitted, "multipart/mixed" is used. // boundary: multipart boundary separator. // If omitted/empty, a random string is generated. - MultiPartFormField(const std::string& name, + explicit MultiPartFormField(const std::string& name, const std::string& content_type = {}, const std::string& boundary = {}); |