From 1eda1f54e6a9ec1c0ef7d58515eba45a8eaa887a Mon Sep 17 00:00:00 2001 From: yaphet <4414314+darionyaphet@users.noreply.github.com> Date: Wed, 2 Mar 2022 19:22:08 +0800 Subject: [PATCH] reduce useless explicit modification (#3954) --- src/common/base/StatusOr.h | 2 +- src/common/datatypes/Date.h | 2 +- src/common/expression/LogicalExpression.h | 2 +- src/common/expression/RelationalExpression.h | 2 +- src/common/expression/SubscriptExpression.h | 5 +---- src/common/expression/UnaryExpression.h | 2 +- src/graph/service/QueryInstance.h | 2 +- src/graph/session/ClientSession.h | 2 +- src/meta/processors/admin/AgentHBProcessor.h | 2 +- src/parser/AdminSentences.h | 5 ++--- src/parser/Clauses.h | 2 +- src/parser/MaintainSentences.h | 6 +++--- src/parser/MatchSentence.h | 10 +++++----- src/parser/MutateSentences.h | 8 ++++---- src/parser/TraverseSentences.h | 6 +++--- src/storage/exec/DeDupNode.h | 2 +- src/storage/exec/IndexAggregateNode.h | 6 +++--- src/storage/exec/IndexNode.h | 2 +- src/storage/kv/GetProcessor.h | 2 +- src/storage/test/ChainTestUtils.h | 6 +++--- 20 files changed, 36 insertions(+), 40 deletions(-) diff --git a/src/common/base/StatusOr.h b/src/common/base/StatusOr.h index 05e1721e927..3aa166df51d 100644 --- a/src/common/base/StatusOr.h +++ b/src/common/base/StatusOr.h @@ -227,7 +227,7 @@ class StatusOr final { } // Type conversion operator, i.e. alias of `ok()' - explicit operator bool() const { + operator bool() const { return ok(); } diff --git a/src/common/datatypes/Date.h b/src/common/datatypes/Date.h index baefd070464..bdb5e2f5135 100644 --- a/src/common/datatypes/Date.h +++ b/src/common/datatypes/Date.h @@ -219,7 +219,7 @@ struct DateTime { sec = 0; microsec = 0; } - explicit DateTime(const Date& date, const Time& time) { + DateTime(const Date& date, const Time& time) { year = date.year; month = date.month; day = date.day; diff --git a/src/common/expression/LogicalExpression.h b/src/common/expression/LogicalExpression.h index 0d7524c619a..f64de79a402 100644 --- a/src/common/expression/LogicalExpression.h +++ b/src/common/expression/LogicalExpression.h @@ -104,7 +104,7 @@ class LogicalExpression final : public Expression { } private: - explicit LogicalExpression(ObjectPool* pool, Kind kind) : Expression(pool, kind) {} + LogicalExpression(ObjectPool* pool, Kind kind) : Expression(pool, kind) {} LogicalExpression(ObjectPool* pool, Kind kind, Expression* lhs, Expression* rhs) : Expression(pool, kind) { diff --git a/src/common/expression/RelationalExpression.h b/src/common/expression/RelationalExpression.h index e15bc7f12f5..7191fed9277 100644 --- a/src/common/expression/RelationalExpression.h +++ b/src/common/expression/RelationalExpression.h @@ -124,7 +124,7 @@ class RelationalExpression final : public BinaryExpression { } private: - explicit RelationalExpression(ObjectPool* pool, Kind kind, Expression* lhs, Expression* rhs) + RelationalExpression(ObjectPool* pool, Kind kind, Expression* lhs, Expression* rhs) : BinaryExpression(pool, kind, lhs, rhs) {} private: diff --git a/src/common/expression/SubscriptExpression.h b/src/common/expression/SubscriptExpression.h index c1534bffc73..d959a7f7cc5 100644 --- a/src/common/expression/SubscriptExpression.h +++ b/src/common/expression/SubscriptExpression.h @@ -106,10 +106,7 @@ class SubscriptRangeExpression final : public Expression { explicit SubscriptRangeExpression(ObjectPool* pool) : Expression(pool, Kind::kSubscriptRange), list_(nullptr), lo_(nullptr), hi_(nullptr) {} - explicit SubscriptRangeExpression(ObjectPool* pool, - Expression* list, - Expression* lo, - Expression* hi) + SubscriptRangeExpression(ObjectPool* pool, Expression* list, Expression* lo, Expression* hi) : Expression(pool, Kind::kSubscriptRange), list_(DCHECK_NOTNULL(list)), lo_(lo), hi_(hi) { DCHECK(!(lo_ == nullptr && hi_ == nullptr)); } diff --git a/src/common/expression/UnaryExpression.h b/src/common/expression/UnaryExpression.h index d17d459b59d..26cd28d766a 100644 --- a/src/common/expression/UnaryExpression.h +++ b/src/common/expression/UnaryExpression.h @@ -75,7 +75,7 @@ class UnaryExpression final : public Expression { } private: - explicit UnaryExpression(ObjectPool* pool, Kind kind, Expression* operand = nullptr) + UnaryExpression(ObjectPool* pool, Kind kind, Expression* operand = nullptr) : Expression(pool, kind), operand_(operand) {} void writeTo(Encoder& encoder) const override; diff --git a/src/graph/service/QueryInstance.h b/src/graph/service/QueryInstance.h index a30168d56cc..a702b41b7d9 100644 --- a/src/graph/service/QueryInstance.h +++ b/src/graph/service/QueryInstance.h @@ -26,7 +26,7 @@ namespace graph { class QueryInstance final : public boost::noncopyable, public cpp::NonMovable { public: - explicit QueryInstance(std::unique_ptr qctx, opt::Optimizer* optimizer); + QueryInstance(std::unique_ptr qctx, opt::Optimizer* optimizer); ~QueryInstance() = default; void execute(); diff --git a/src/graph/session/ClientSession.h b/src/graph/session/ClientSession.h index 2879908251a..a8b085a468c 100644 --- a/src/graph/session/ClientSession.h +++ b/src/graph/session/ClientSession.h @@ -163,7 +163,7 @@ class ClientSession final { private: ClientSession() = default; - explicit ClientSession(meta::cpp2::Session&& session, meta::MetaClient* metaClient); + ClientSession(meta::cpp2::Session&& session, meta::MetaClient* metaClient); private: SpaceInfo space_; // The space that the session is using. diff --git a/src/meta/processors/admin/AgentHBProcessor.h b/src/meta/processors/admin/AgentHBProcessor.h index 16b8a7e150a..6aad547a7d0 100644 --- a/src/meta/processors/admin/AgentHBProcessor.h +++ b/src/meta/processors/admin/AgentHBProcessor.h @@ -51,7 +51,7 @@ class AgentHBProcessor : public BaseProcessor { void onFinished() override; private: - explicit AgentHBProcessor(kvstore::KVStore* kvstore, const AgentHBCounters* counters) + AgentHBProcessor(kvstore::KVStore* kvstore, const AgentHBCounters* counters) : BaseProcessor(kvstore), counters_(counters) {} const AgentHBCounters* counters_{nullptr}; diff --git a/src/parser/AdminSentences.h b/src/parser/AdminSentences.h index c4f77f6e3be..dcf606f6dd4 100644 --- a/src/parser/AdminSentences.h +++ b/src/parser/AdminSentences.h @@ -703,8 +703,7 @@ class ShowServiceClientsSentence final : public Sentence { class SignInServiceSentence final : public Sentence { public: - explicit SignInServiceSentence(const meta::cpp2::ExternalServiceType& type, - ServiceClientList* clients) + SignInServiceSentence(const meta::cpp2::ExternalServiceType& type, ServiceClientList* clients) : type_(type) { kind_ = Kind::kSignInService; clients_.reset(clients); @@ -797,7 +796,7 @@ class ShowQueriesSentence final : public Sentence { class QueryUniqueIdentifier final { public: - explicit QueryUniqueIdentifier(Expression* epId, Expression* sessionId) + QueryUniqueIdentifier(Expression* epId, Expression* sessionId) : epId_(epId), sessionId_(sessionId) {} Expression* sessionId() const { diff --git a/src/parser/Clauses.h b/src/parser/Clauses.h index 62cee580e5c..fd62eb20418 100644 --- a/src/parser/Clauses.h +++ b/src/parser/Clauses.h @@ -401,7 +401,7 @@ class BoundClause final { public: enum BoundType : uint8_t { IN, OUT, BOTH }; - explicit BoundClause(OverEdges *edges, BoundType type) { + BoundClause(OverEdges *edges, BoundType type) { overEdges_.reset(edges); boundType_ = type; } diff --git a/src/parser/MaintainSentences.h b/src/parser/MaintainSentences.h index a42dbd2e489..4ea06da8f64 100644 --- a/src/parser/MaintainSentences.h +++ b/src/parser/MaintainSentences.h @@ -516,7 +516,7 @@ class DescribeEdgeSentence final : public Sentence { class DropTagSentence final : public DropSentence { public: - explicit DropTagSentence(std::string *name, bool ifExists) : DropSentence(ifExists) { + DropTagSentence(std::string *name, bool ifExists) : DropSentence(ifExists) { name_.reset(name); kind_ = Kind::kDropTag; } @@ -533,7 +533,7 @@ class DropTagSentence final : public DropSentence { class DropEdgeSentence final : public DropSentence { public: - explicit DropEdgeSentence(std::string *name, bool ifExists) : DropSentence(ifExists) { + DropEdgeSentence(std::string *name, bool ifExists) : DropSentence(ifExists) { name_.reset(name); kind_ = Kind::kDropEdge; } @@ -772,7 +772,7 @@ class DescribeEdgeIndexSentence final : public Sentence { class DropTagIndexSentence final : public DropSentence { public: - explicit DropTagIndexSentence(std::string *indexName, bool ifExists) : DropSentence(ifExists) { + DropTagIndexSentence(std::string *indexName, bool ifExists) : DropSentence(ifExists) { indexName_.reset(indexName); kind_ = Kind::kDropTagIndex; } diff --git a/src/parser/MatchSentence.h b/src/parser/MatchSentence.h index 4fa7619b95f..2cab6137348 100644 --- a/src/parser/MatchSentence.h +++ b/src/parser/MatchSentence.h @@ -304,11 +304,11 @@ class MatchReturnItems final { class MatchReturn final { public: - explicit MatchReturn(MatchReturnItems* returnItems = nullptr, - OrderFactors* orderFactors = nullptr, - Expression* skip = nullptr, - Expression* limit = nullptr, - bool distinct = false) { + MatchReturn(MatchReturnItems* returnItems = nullptr, + OrderFactors* orderFactors = nullptr, + Expression* skip = nullptr, + Expression* limit = nullptr, + bool distinct = false) { returnItems_.reset(returnItems); orderFactors_.reset(orderFactors); skip_ = skip; diff --git a/src/parser/MutateSentences.h b/src/parser/MutateSentences.h index 5016b7e9889..2fcc12ed31b 100644 --- a/src/parser/MutateSentences.h +++ b/src/parser/MutateSentences.h @@ -254,10 +254,10 @@ class EdgeRowList final { class InsertEdgesSentence final : public Sentence { public: - explicit InsertEdgesSentence(std::string *edge, - EdgeRowList *rows, - bool ifNotExists, - bool ignoreExistedIndex) + InsertEdgesSentence(std::string *edge, + EdgeRowList *rows, + bool ifNotExists, + bool ignoreExistedIndex) : Sentence(Kind::kInsertEdges) { edge_.reset(edge); rows_.reset(rows); diff --git a/src/parser/TraverseSentences.h b/src/parser/TraverseSentences.h index 9b685e1713d..f4044e0aae1 100644 --- a/src/parser/TraverseSentences.h +++ b/src/parser/TraverseSentences.h @@ -290,14 +290,14 @@ class FetchVerticesSentence final : public Sentence { yieldClause_.reset(clause); } - explicit FetchVerticesSentence(Expression* ref, YieldClause* clause) { + FetchVerticesSentence(Expression* ref, YieldClause* clause) { kind_ = Kind::kFetchVertices; tags_ = std::make_unique(); vertices_.reset(new VerticesClause(ref)); yieldClause_.reset(clause); } - explicit FetchVerticesSentence(VertexIDList* vidList, YieldClause* clause) { + FetchVerticesSentence(VertexIDList* vidList, YieldClause* clause) { kind_ = Kind::kFetchVertices; tags_ = std::make_unique(); vertices_.reset(new VerticesClause(vidList)); @@ -474,7 +474,7 @@ class FindPathSentence final : public Sentence { class LimitSentence final : public Sentence { public: - explicit LimitSentence(int64_t offset, int64_t count) : offset_(offset), count_(count) { + LimitSentence(int64_t offset, int64_t count) : offset_(offset), count_(count) { kind_ = Kind::kLimit; } diff --git a/src/storage/exec/DeDupNode.h b/src/storage/exec/DeDupNode.h index a91f38504c5..34fd966ff4b 100644 --- a/src/storage/exec/DeDupNode.h +++ b/src/storage/exec/DeDupNode.h @@ -19,7 +19,7 @@ class DeDupNode : public IterateNode { public: using RelNode::doExecute; - explicit DeDupNode(nebula::DataSet* resultSet, const std::vector& pos) + DeDupNode(nebula::DataSet* resultSet, const std::vector& pos) : resultSet_(resultSet), pos_(pos) { IterateNode::name_ = "DedupNode"; } diff --git a/src/storage/exec/IndexAggregateNode.h b/src/storage/exec/IndexAggregateNode.h index a3b2f2e5a82..21c28d50787 100644 --- a/src/storage/exec/IndexAggregateNode.h +++ b/src/storage/exec/IndexAggregateNode.h @@ -25,9 +25,9 @@ struct ColumnStat { class IndexAggregateNode : public IndexNode { public: IndexAggregateNode(const IndexAggregateNode& node); - explicit IndexAggregateNode(RuntimeContext* context, - const std::vector>& statInfos, - size_t returnColumnsCount); + IndexAggregateNode(RuntimeContext* context, + const std::vector>& statInfos, + size_t returnColumnsCount); nebula::cpp2::ErrorCode init(InitContext& ctx) override; void initStatValue(); diff --git a/src/storage/exec/IndexNode.h b/src/storage/exec/IndexNode.h index 9f7ec609c41..3172a981e64 100644 --- a/src/storage/exec/IndexNode.h +++ b/src/storage/exec/IndexNode.h @@ -115,7 +115,7 @@ class IndexNode { }; /* build */ IndexNode(const IndexNode& node); - explicit IndexNode(RuntimeContext* context, const std::string& name); + IndexNode(RuntimeContext* context, const std::string& name); virtual ~IndexNode() = default; virtual std::unique_ptr copy() = 0; void addChild(std::unique_ptr child) { diff --git a/src/storage/kv/GetProcessor.h b/src/storage/kv/GetProcessor.h index a4fa6907223..bd496c993b9 100644 --- a/src/storage/kv/GetProcessor.h +++ b/src/storage/kv/GetProcessor.h @@ -27,7 +27,7 @@ class GetProcessor : public BaseProcessor { void process(const cpp2::KVGetRequest& req); protected: - explicit GetProcessor(StorageEnv* env, const ProcessorCounters* counters) + GetProcessor(StorageEnv* env, const ProcessorCounters* counters) : BaseProcessor(env, counters) {} }; diff --git a/src/storage/test/ChainTestUtils.h b/src/storage/test/ChainTestUtils.h index 13bd708ca0e..22b1159ac03 100644 --- a/src/storage/test/ChainTestUtils.h +++ b/src/storage/test/ChainTestUtils.h @@ -370,9 +370,9 @@ class MetaClientTestUpdater { class FakeInternalStorageClient : public InternalStorageClient { public: - explicit FakeInternalStorageClient(StorageEnv* env, - std::shared_ptr pool, - Code code) + FakeInternalStorageClient(StorageEnv* env, + std::shared_ptr pool, + Code code) : InternalStorageClient(pool, env->metaClient_), env_(env), code_(code) {} void chainUpdateEdge(cpp2::UpdateEdgeRequest& req,