[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.
This commit is contained in:
Thiago Marcos P. Santos
2020-03-27 18:30:35 +02:00
parent cc8b0e1746
commit ea2477f2ea
6 changed files with 10 additions and 9 deletions

View File

@@ -90,8 +90,8 @@ protected:
template <typename TaskFn, typename ReplyFn>
void scheduleAndReplyValue(const TaskFn& task,
const ReplyFn& reply,
const mapbox::base::WeakPtr<Scheduler>& replyScheduler) {
auto scheduled = [replyScheduler, task, reply] {
mapbox::base::WeakPtr<Scheduler> replyScheduler) {
auto scheduled = [replyScheduler = std::move(replyScheduler), task, reply] {
auto lock = replyScheduler.lock();
if (!replyScheduler) return;
auto scheduledReply = [reply, result = task()] { reply(result); };

View File

@@ -49,8 +49,8 @@ private:
class Var : public Expression {
public:
Var(std::string name_, const std::shared_ptr<Expression>& value_)
: Expression(Kind::Var, value_->getType()), name(std::move(name_)), value(value_) {}
Var(std::string name_, std::shared_ptr<Expression> value_)
: Expression(Kind::Var, value_->getType()), name(std::move(name_)), value(std::move(value_)) {}
static ParseResult parse(const mbgl::style::conversion::Convertible&, ParsingContext&);

View File

@@ -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> value_) : Expression(Kind::Literal, type_), value(value_) {}
Literal(const type::Array& type_, std::vector<Value> value_)
: Expression(Kind::Literal, type_), value(std::move(value_)) {}
EvaluationResult evaluate(const EvaluationContext&) const override {
return value;