summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2020-03-27 18:30:35 +0200
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2020-04-17 13:36:50 +0300
commitea2477f2ea9f1ccebe0263104ad13d729fdbcfdf (patch)
treea88ca30d490124c508284116f4c9e267400b8c3c
parentcc8b0e1746cfc6fdc99582fdb09e7624b14d9d0e (diff)
downloadqtlocation-mapboxgl-ea2477f2ea9f1ccebe0263104ad13d729fdbcfdf.tar.gz
[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.
-rw-r--r--include/mbgl/actor/scheduler.hpp4
-rw-r--r--include/mbgl/style/expression/let.hpp4
-rw-r--r--include/mbgl/style/expression/literal.hpp3
-rw-r--r--src/mbgl/layout/symbol_layout.cpp2
-rw-r--r--src/mbgl/style/expression/boolean_operator.cpp4
-rw-r--r--src/mbgl/style/expression/length.cpp2
6 files changed, 10 insertions, 9 deletions
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 <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); };
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<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&);
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> 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;
diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp
index d996041ebe..109f1dffa8 100644
--- a/src/mbgl/layout/symbol_layout.cpp
+++ b/src/mbgl/layout/symbol_layout.cpp
@@ -371,7 +371,7 @@ void SymbolLayout::prepareSymbols(const GlyphMap& glyphMap,
WritingModeType writingMode,
SymbolAnchorType textAnchor,
TextJustifyType textJustify) {
- const Shaping result = getShaping(
+ Shaping result = getShaping(
/* string */ formattedText,
/* maxWidth: ems */
isPointPlacement ? layout->evaluate<TextMaxWidth>(zoom, feature, canonicalID) * util::ONE_EM : 0.0f,
diff --git a/src/mbgl/style/expression/boolean_operator.cpp b/src/mbgl/style/expression/boolean_operator.cpp
index a02c08131f..6beae6062a 100644
--- a/src/mbgl/style/expression/boolean_operator.cpp
+++ b/src/mbgl/style/expression/boolean_operator.cpp
@@ -7,7 +7,7 @@ namespace expression {
EvaluationResult Any::evaluate(const EvaluationContext& params) const {
for (const auto& input : inputs) {
- const EvaluationResult result = input->evaluate(params);
+ EvaluationResult result = input->evaluate(params);
if (!result) return result;
if (result->get<bool>()) return EvaluationResult(true);
}
@@ -35,7 +35,7 @@ std::vector<optional<Value>> Any::possibleOutputs() const {
EvaluationResult All::evaluate(const EvaluationContext& params) const {
for (const auto& input : inputs) {
- const EvaluationResult result = input->evaluate(params);
+ EvaluationResult result = input->evaluate(params);
if (!result) return result;
if (!result->get<bool>()) return EvaluationResult(false);
}
diff --git a/src/mbgl/style/expression/length.cpp b/src/mbgl/style/expression/length.cpp
index f1b58d7952..340a2debea 100644
--- a/src/mbgl/style/expression/length.cpp
+++ b/src/mbgl/style/expression/length.cpp
@@ -12,7 +12,7 @@ Length::Length(std::unique_ptr<Expression> input_)
}
EvaluationResult Length::evaluate(const EvaluationContext& params) const {
- const EvaluationResult value = input->evaluate(params);
+ EvaluationResult value = input->evaluate(params);
if (!value) return value;
return value->match(
[] (const std::string& s) {