From ea2477f2ea9f1ccebe0263104ad13d729fdbcfdf Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Fri, 27 Mar 2020 18:30:35 +0200 Subject: [core] Fix performance-no-automatic-move (bonus) As reported by clang-tidy-10. We don't run clang-tidy-10 yet. We should probably consider moving the bots at some point so errors like this won't return. --- include/mbgl/actor/scheduler.hpp | 4 ++-- include/mbgl/style/expression/let.hpp | 4 ++-- include/mbgl/style/expression/literal.hpp | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/mbgl/actor/scheduler.hpp b/include/mbgl/actor/scheduler.hpp index 1a9ba1907f..dbc1a94f47 100644 --- a/include/mbgl/actor/scheduler.hpp +++ b/include/mbgl/actor/scheduler.hpp @@ -90,8 +90,8 @@ protected: template void scheduleAndReplyValue(const TaskFn& task, const ReplyFn& reply, - const mapbox::base::WeakPtr& replyScheduler) { - auto scheduled = [replyScheduler, task, reply] { + mapbox::base::WeakPtr replyScheduler) { + auto scheduled = [replyScheduler = std::move(replyScheduler), task, reply] { auto lock = replyScheduler.lock(); if (!replyScheduler) return; auto scheduledReply = [reply, result = task()] { reply(result); }; diff --git a/include/mbgl/style/expression/let.hpp b/include/mbgl/style/expression/let.hpp index 7c468dfeb1..a03c4b7d70 100644 --- a/include/mbgl/style/expression/let.hpp +++ b/include/mbgl/style/expression/let.hpp @@ -49,8 +49,8 @@ private: class Var : public Expression { public: - Var(std::string name_, const std::shared_ptr& value_) - : Expression(Kind::Var, value_->getType()), name(std::move(name_)), value(value_) {} + Var(std::string name_, std::shared_ptr value_) + : Expression(Kind::Var, value_->getType()), name(std::move(name_)), value(std::move(value_)) {} static ParseResult parse(const mbgl::style::conversion::Convertible&, ParsingContext&); diff --git a/include/mbgl/style/expression/literal.hpp b/include/mbgl/style/expression/literal.hpp index f704a34a59..e8f0a5d9ee 100644 --- a/include/mbgl/style/expression/literal.hpp +++ b/include/mbgl/style/expression/literal.hpp @@ -14,7 +14,8 @@ class Literal : public Expression { public: Literal(const Value& value_) : Expression(Kind::Literal, typeOf(value_)), value(value_) {} - Literal(const type::Array& type_, std::vector value_) : Expression(Kind::Literal, type_), value(value_) {} + Literal(const type::Array& type_, std::vector value_) + : Expression(Kind::Literal, type_), value(std::move(value_)) {} EvaluationResult evaluate(const EvaluationContext&) const override { return value; -- cgit v1.2.1