From a40b755b6a048c72fddab1261cefec6b267017bf Mon Sep 17 00:00:00 2001 From: Yi Wang Date: Fri, 4 Aug 2017 14:15:39 -0700 Subject: [PATCH] Add explicit to some constructors --- paddle/operators/recurrent_op.h | 2 -- paddle/platform/device_context.h | 2 +- paddle/platform/place.h | 2 +- paddle/string/piece.h | 4 ++-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/paddle/operators/recurrent_op.h b/paddle/operators/recurrent_op.h index 35e6d9d50d..f859dc333d 100644 --- a/paddle/operators/recurrent_op.h +++ b/paddle/operators/recurrent_op.h @@ -19,8 +19,6 @@ namespace paddle { namespace operators { -using namespace paddle::framework; // NOLINT - namespace rnn { /** diff --git a/paddle/platform/device_context.h b/paddle/platform/device_context.h index 48b9f5dcb5..08b5b2cff9 100644 --- a/paddle/platform/device_context.h +++ b/paddle/platform/device_context.h @@ -55,7 +55,7 @@ class CPUDeviceContext : public DeviceContext { class CUDADeviceContext : public DeviceContext { public: - CUDADeviceContext(GPUPlace); // NOLINT + explicit CUDADeviceContext(GPUPlace); virtual ~CUDADeviceContext(); /*! \brief Wait for all operations completion in the stream. */ diff --git a/paddle/platform/place.h b/paddle/platform/place.h index a37ad38a8f..a82e8c942f 100644 --- a/paddle/platform/place.h +++ b/paddle/platform/place.h @@ -32,7 +32,7 @@ struct CPUPlace { struct GPUPlace { GPUPlace() : GPUPlace(0) {} - GPUPlace(int d) : device(d) {} // NOLINT + explicit GPUPlace(int d) : device(d) {} // needed for variant equality comparison inline bool operator==(const GPUPlace &o) const { return device == o.device; } diff --git a/paddle/string/piece.h b/paddle/string/piece.h index 3b887490b5..7deeacd8ca 100644 --- a/paddle/string/piece.h +++ b/paddle/string/piece.h @@ -39,8 +39,8 @@ public: // size_ is 0. Piece(); Piece(const char* d, size_t n); - Piece(const char* d); // NOLINT - Piece(const std::string& s); // NOLINT + explicit Piece(const char* d); + explicit Piece(const std::string& s); const char* data() const { return data_; } size_t len() const { return size_; } -- GitLab