diff options
author | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2019-09-23 17:41:33 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2019-09-25 18:59:07 +0300 |
commit | c7bbd5bbef0780df5d0a5498e14051ee63c24e44 (patch) | |
tree | 4d1803a26e86327b404dc810709b7ea1c0a9453d /src | |
parent | 3c23f6f9f7f92ef43cb3d78e5570976058cf49c5 (diff) | |
download | qtlocation-mapboxgl-c7bbd5bbef0780df5d0a5498e14051ee63c24e44.tar.gz |
[core] Fix performance-move-const-arg
Diffstat (limited to 'src')
44 files changed, 88 insertions, 127 deletions
diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp index 4d9c2055de..18b376e3dc 100644 --- a/src/mbgl/gl/context.cpp +++ b/src/mbgl/gl/context.cpp @@ -210,7 +210,8 @@ UniqueTexture Context::createUniqueTexture() { TextureID id = pooledTextures.back(); pooledTextures.pop_back(); - return UniqueTexture{ std::move(id), { this } }; + // NOLINTNEXTLINE(performance-move-const-arg) + return UniqueTexture{std::move(id), {this}}; } bool Context::supportsVertexArrays() const { @@ -224,6 +225,7 @@ VertexArray Context::createVertexArray() { if (supportsVertexArrays()) { VertexArrayID id = 0; MBGL_CHECK_ERROR(vertexArray->genVertexArrays(1, &id)); + // NOLINTNEXTLINE(performance-move-const-arg) UniqueVertexArray vao(std::move(id), { this }); return { UniqueVertexArrayState(new VertexArrayState(std::move(vao)), VertexArrayStateDeleter { true })}; } else { @@ -236,6 +238,7 @@ VertexArray Context::createVertexArray() { UniqueFramebuffer Context::createFramebuffer() { FramebufferID id = 0; MBGL_CHECK_ERROR(glGenFramebuffers(1, &id)); + // NOLINTNEXTLINE(performance-move-const-arg) return UniqueFramebuffer{ std::move(id), { this } }; } @@ -269,6 +272,7 @@ std::unique_ptr<gfx::RenderbufferResource> Context::createRenderbufferResource(const gfx::RenderbufferPixelType type, const Size size) { RenderbufferID id = 0; MBGL_CHECK_ERROR(glGenRenderbuffers(1, &id)); + // NOLINTNEXTLINE(performance-move-const-arg) UniqueRenderbuffer renderbuffer{ std::move(id), { this } }; bindRenderbuffer = renderbuffer; diff --git a/src/mbgl/gl/uniform.hpp b/src/mbgl/gl/uniform.hpp index 10501036cb..9f752de8af 100644 --- a/src/mbgl/gl/uniform.hpp +++ b/src/mbgl/gl/uniform.hpp @@ -37,8 +37,7 @@ ActiveUniforms activeUniforms(ProgramID); template <class Value> class UniformState { public: - UniformState(UniformLocation location_ = -1) : location(std::move(location_)) { - } + UniformState(UniformLocation location_ = -1) : location(location_) {} void operator=(const Value& value) { if (location >= 0 && (!current || *current != value)) { diff --git a/src/mbgl/gl/upload_pass.cpp b/src/mbgl/gl/upload_pass.cpp index 358f1a7203..4312488fb4 100644 --- a/src/mbgl/gl/upload_pass.cpp +++ b/src/mbgl/gl/upload_pass.cpp @@ -20,6 +20,7 @@ std::unique_ptr<gfx::VertexBufferResource> UploadPass::createVertexBufferResourc const void* data, std::size_t size, const gfx::BufferUsageType usage) { BufferID id = 0; MBGL_CHECK_ERROR(glGenBuffers(1, &id)); + // NOLINTNEXTLINE(performance-move-const-arg) UniqueBuffer result{ std::move(id), { commandEncoder.context } }; commandEncoder.context.vertexBuffer = result; MBGL_CHECK_ERROR( @@ -38,6 +39,7 @@ std::unique_ptr<gfx::IndexBufferResource> UploadPass::createIndexBufferResource( const void* data, std::size_t size, const gfx::BufferUsageType usage) { BufferID id = 0; MBGL_CHECK_ERROR(glGenBuffers(1, &id)); + // NOLINTNEXTLINE(performance-move-const-arg) UniqueBuffer result{ std::move(id), { commandEncoder.context } }; commandEncoder.context.bindVertexArray = 0; commandEncoder.context.globalVertexArrayState.indexBuffer = result; diff --git a/src/mbgl/layermanager/background_layer_factory.cpp b/src/mbgl/layermanager/background_layer_factory.cpp index 0e27e10343..b20e9a1930 100644 --- a/src/mbgl/layermanager/background_layer_factory.cpp +++ b/src/mbgl/layermanager/background_layer_factory.cpp @@ -17,7 +17,7 @@ std::unique_ptr<style::Layer> BackgroundLayerFactory::createLayer(const std::str std::unique_ptr<RenderLayer> BackgroundLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept { assert(impl->getTypeInfo() == getTypeInfo()); - return std::make_unique<RenderBackgroundLayer>(staticImmutableCast<style::BackgroundLayer::Impl>(std::move(impl))); + return std::make_unique<RenderBackgroundLayer>(staticImmutableCast<style::BackgroundLayer::Impl>(impl)); } } // namespace mbgl diff --git a/src/mbgl/layermanager/circle_layer_factory.cpp b/src/mbgl/layermanager/circle_layer_factory.cpp index 28c64fc400..0f6ee6d407 100644 --- a/src/mbgl/layermanager/circle_layer_factory.cpp +++ b/src/mbgl/layermanager/circle_layer_factory.cpp @@ -30,7 +30,7 @@ std::unique_ptr<Bucket> CircleLayerFactory::createBucket(const BucketParameters& std::unique_ptr<RenderLayer> CircleLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept { assert(impl->getTypeInfo() == getTypeInfo()); - return std::make_unique<RenderCircleLayer>(staticImmutableCast<style::CircleLayer::Impl>(std::move(impl))); + return std::make_unique<RenderCircleLayer>(staticImmutableCast<style::CircleLayer::Impl>(impl)); } } // namespace mbgl diff --git a/src/mbgl/layermanager/custom_layer_factory.cpp b/src/mbgl/layermanager/custom_layer_factory.cpp index 31b1730fc9..f84f261e79 100644 --- a/src/mbgl/layermanager/custom_layer_factory.cpp +++ b/src/mbgl/layermanager/custom_layer_factory.cpp @@ -16,7 +16,7 @@ std::unique_ptr<style::Layer> CustomLayerFactory::createLayer(const std::string& } std::unique_ptr<RenderLayer> CustomLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept { - return std::make_unique<RenderCustomLayer>(staticImmutableCast<style::CustomLayer::Impl>(std::move(impl))); + return std::make_unique<RenderCustomLayer>(staticImmutableCast<style::CustomLayer::Impl>(impl)); } } // namespace mbgl diff --git a/src/mbgl/layermanager/fill_extrusion_layer_factory.cpp b/src/mbgl/layermanager/fill_extrusion_layer_factory.cpp index 6ffbcaadae..0163321914 100644 --- a/src/mbgl/layermanager/fill_extrusion_layer_factory.cpp +++ b/src/mbgl/layermanager/fill_extrusion_layer_factory.cpp @@ -34,7 +34,7 @@ std::unique_ptr<Layout> FillExtrusionLayerFactory::createLayout(const LayoutPara std::unique_ptr<RenderLayer> FillExtrusionLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept { assert(impl->getTypeInfo() == getTypeInfo()); - return std::make_unique<RenderFillExtrusionLayer>(staticImmutableCast<style::FillExtrusionLayer::Impl>(std::move(impl))); + return std::make_unique<RenderFillExtrusionLayer>(staticImmutableCast<style::FillExtrusionLayer::Impl>(impl)); } } // namespace mbgl diff --git a/src/mbgl/layermanager/fill_layer_factory.cpp b/src/mbgl/layermanager/fill_layer_factory.cpp index 32779f2deb..f7f24c58a1 100644 --- a/src/mbgl/layermanager/fill_layer_factory.cpp +++ b/src/mbgl/layermanager/fill_layer_factory.cpp @@ -35,7 +35,7 @@ FillLayerFactory::createLayout(const LayoutParameters& parameters, std::unique_ptr<RenderLayer> FillLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept { assert(impl->getTypeInfo() == getTypeInfo()); - return std::make_unique<RenderFillLayer>(staticImmutableCast<style::FillLayer::Impl>(std::move(impl))); + return std::make_unique<RenderFillLayer>(staticImmutableCast<style::FillLayer::Impl>(impl)); } } // namespace mbgl diff --git a/src/mbgl/layermanager/heatmap_layer_factory.cpp b/src/mbgl/layermanager/heatmap_layer_factory.cpp index 1cd5d18f79..221a103053 100644 --- a/src/mbgl/layermanager/heatmap_layer_factory.cpp +++ b/src/mbgl/layermanager/heatmap_layer_factory.cpp @@ -30,7 +30,7 @@ std::unique_ptr<Bucket> HeatmapLayerFactory::createBucket(const BucketParameters std::unique_ptr<RenderLayer> HeatmapLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept { assert(impl->getTypeInfo() == getTypeInfo()); - return std::make_unique<RenderHeatmapLayer>(staticImmutableCast<style::HeatmapLayer::Impl>(std::move(impl))); + return std::make_unique<RenderHeatmapLayer>(staticImmutableCast<style::HeatmapLayer::Impl>(impl)); } } // namespace mbgl diff --git a/src/mbgl/layermanager/hillshade_layer_factory.cpp b/src/mbgl/layermanager/hillshade_layer_factory.cpp index 9291af0711..c2981e17ed 100644 --- a/src/mbgl/layermanager/hillshade_layer_factory.cpp +++ b/src/mbgl/layermanager/hillshade_layer_factory.cpp @@ -22,7 +22,7 @@ std::unique_ptr<style::Layer> HillshadeLayerFactory::createLayer(const std::stri std::unique_ptr<RenderLayer> HillshadeLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept { assert(impl->getTypeInfo() == getTypeInfo()); - return std::make_unique<RenderHillshadeLayer>(staticImmutableCast<style::HillshadeLayer::Impl>(std::move(impl))); + return std::make_unique<RenderHillshadeLayer>(staticImmutableCast<style::HillshadeLayer::Impl>(impl)); } } // namespace mbgl diff --git a/src/mbgl/layermanager/line_layer_factory.cpp b/src/mbgl/layermanager/line_layer_factory.cpp index e819656ad0..b0f2827a80 100644 --- a/src/mbgl/layermanager/line_layer_factory.cpp +++ b/src/mbgl/layermanager/line_layer_factory.cpp @@ -34,7 +34,7 @@ std::unique_ptr<Layout> LineLayerFactory::createLayout(const LayoutParameters& p std::unique_ptr<RenderLayer> LineLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept { assert(impl->getTypeInfo() == getTypeInfo()); - return std::make_unique<RenderLineLayer>(staticImmutableCast<style::LineLayer::Impl>(std::move(impl))); + return std::make_unique<RenderLineLayer>(staticImmutableCast<style::LineLayer::Impl>(impl)); } } // namespace mbgl diff --git a/src/mbgl/layermanager/raster_layer_factory.cpp b/src/mbgl/layermanager/raster_layer_factory.cpp index ac9205a140..172d445477 100644 --- a/src/mbgl/layermanager/raster_layer_factory.cpp +++ b/src/mbgl/layermanager/raster_layer_factory.cpp @@ -22,7 +22,7 @@ std::unique_ptr<style::Layer> RasterLayerFactory::createLayer(const std::string& std::unique_ptr<RenderLayer> RasterLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept { assert(impl->getTypeInfo() == getTypeInfo()); - return std::make_unique<RenderRasterLayer>(staticImmutableCast<style::RasterLayer::Impl>(std::move(impl))); + return std::make_unique<RenderRasterLayer>(staticImmutableCast<style::RasterLayer::Impl>(impl)); } } // namespace mbgl diff --git a/src/mbgl/layermanager/symbol_layer_factory.cpp b/src/mbgl/layermanager/symbol_layer_factory.cpp index f5a4640db7..7141f5a223 100644 --- a/src/mbgl/layermanager/symbol_layer_factory.cpp +++ b/src/mbgl/layermanager/symbol_layer_factory.cpp @@ -36,7 +36,7 @@ std::unique_ptr<Layout> SymbolLayerFactory::createLayout(const LayoutParameters& std::unique_ptr<RenderLayer> SymbolLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept { assert(impl->getTypeInfo() == getTypeInfo()); - return std::make_unique<RenderSymbolLayer>(staticImmutableCast<style::SymbolLayer::Impl>(std::move(impl))); + return std::make_unique<RenderSymbolLayer>(staticImmutableCast<style::SymbolLayer::Impl>(impl)); } } // namespace mbgl diff --git a/src/mbgl/layout/symbol_projection.hpp b/src/mbgl/layout/symbol_projection.hpp index 58c635eaae..b88ff0a56f 100644 --- a/src/mbgl/layout/symbol_projection.hpp +++ b/src/mbgl/layout/symbol_projection.hpp @@ -29,11 +29,9 @@ namespace mbgl { : point(point_), angle(angle_), tileDistance(std::move(tileDistance_)) {} PlacedGlyph(PlacedGlyph&& other) noexcept - : point(std::move(other.point)), angle(other.angle), tileDistance(std::move(other.tileDistance)) - {} + : point(other.point), angle(other.angle), tileDistance(std::move(other.tileDistance)) {} PlacedGlyph(const PlacedGlyph& other) - : point(std::move(other.point)), angle(other.angle), tileDistance(std::move(other.tileDistance)) - {} + : point(other.point), angle(other.angle), tileDistance(other.tileDistance) {} Point<float> point; float angle; optional<TileDistance> tileDistance; diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp index 7ec41be37a..e88bb5465c 100644 --- a/src/mbgl/map/transform.cpp +++ b/src/mbgl/map/transform.cpp @@ -356,7 +356,7 @@ void Transform::setLatLngBounds(LatLngBounds bounds) { if (!bounds.valid()) { throw std::runtime_error("failed to set bounds: bounds are invalid"); } - state.setLatLngBounds(std::move(bounds)); + state.setLatLngBounds(bounds); } void Transform::setMinZoom(const double minZoom) { diff --git a/src/mbgl/programs/collision_box_program.hpp b/src/mbgl/programs/collision_box_program.hpp index 3b5142633d..9ba9679566 100644 --- a/src/mbgl/programs/collision_box_program.hpp +++ b/src/mbgl/programs/collision_box_program.hpp @@ -172,21 +172,20 @@ public: drawScopeIt = segment.drawScopes.emplace(layerID, context.createDrawScope()).first; } - program->draw( - context, - renderPass, - std::move(drawMode), - std::move(depthMode), - std::move(stencilMode), - std::move(colorMode), - std::move(cullFaceMode), - uniformValues, - drawScopeIt->second, - allAttributeBindings.offset(segment.vertexOffset), - textureBindings, - indexBuffer, - segment.indexOffset, - segment.indexLength); + program->draw(context, + renderPass, + drawMode, + depthMode, + stencilMode, + colorMode, + cullFaceMode, + uniformValues, + drawScopeIt->second, + allAttributeBindings.offset(segment.vertexOffset), + textureBindings, + indexBuffer, + segment.indexOffset, + segment.indexLength); } } }; diff --git a/src/mbgl/programs/programs.cpp b/src/mbgl/programs/programs.cpp index f82e46c9a2..ce5bbd7eec 100644 --- a/src/mbgl/programs/programs.cpp +++ b/src/mbgl/programs/programs.cpp @@ -16,8 +16,7 @@ Programs::Programs(gfx::Context& context_, const ProgramParameters& programParam : debug(context_, programParameters_), clippingMask(context_, programParameters_), context(context_), - programParameters(std::move(programParameters_)) { -} + programParameters(programParameters_) {} Programs::~Programs() = default; diff --git a/src/mbgl/renderer/buckets/line_bucket.cpp b/src/mbgl/renderer/buckets/line_bucket.cpp index f65c239968..e756722854 100644 --- a/src/mbgl/renderer/buckets/line_bucket.cpp +++ b/src/mbgl/renderer/buckets/line_bucket.cpp @@ -14,10 +14,7 @@ LineBucket::LineBucket(const style::LineLayoutProperties::PossiblyEvaluated layo const std::map<std::string, Immutable<style::LayerProperties>>& layerPaintProperties, const float zoom_, const uint32_t overscaling_) - : layout(std::move(layout_)), - zoom(zoom_), - overscaling(overscaling_) { - + : layout(layout_), zoom(zoom_), overscaling(overscaling_) { for (const auto& pair : layerPaintProperties) { paintPropertyBinders.emplace( std::piecewise_construct, diff --git a/src/mbgl/renderer/buckets/symbol_bucket.cpp b/src/mbgl/renderer/buckets/symbol_bucket.cpp index 5835dd9b86..03ab1c87d1 100644 --- a/src/mbgl/renderer/buckets/symbol_bucket.cpp +++ b/src/mbgl/renderer/buckets/symbol_bucket.cpp @@ -26,7 +26,7 @@ SymbolBucket::SymbolBucket(Immutable<style::SymbolLayoutProperties::PossiblyEval bool allowVerticalPlacement_, std::vector<style::TextWritingModeType> placementModes_) : layout(std::move(layout_)), - bucketLeaderID(std::move(bucketName_)), + bucketLeaderID(bucketName_), iconsNeedLinear(iconsNeedLinear_ || iconSize.isDataDriven() || !iconSize.isZoomConstant()), sortFeaturesByY(sortFeaturesByY_), staticUploaded(false), @@ -35,14 +35,13 @@ SymbolBucket::SymbolBucket(Immutable<style::SymbolLayoutProperties::PossiblyEval sortUploaded(false), justReloaded(false), hasVariablePlacement(false), - symbolInstances(std::move(symbolInstances_)), + symbolInstances(symbolInstances_), textSizeBinder(SymbolSizeBinder::create(zoom, textSize, TextSize::defaultValue())), iconSizeBinder(SymbolSizeBinder::create(zoom, iconSize, IconSize::defaultValue())), tilePixelRatio(tilePixelRatio_), bucketInstanceId(++maxBucketInstanceId), allowVerticalPlacement(allowVerticalPlacement_), placementModes(std::move(placementModes_)) { - for (const auto& pair : paintProperties_) { const auto& evaluated = getEvaluated<SymbolLayerProperties>(pair.second); paintProperties.emplace( diff --git a/src/mbgl/renderer/image_manager.cpp b/src/mbgl/renderer/image_manager.cpp index 4bbdbca5d9..d001084f92 100644 --- a/src/mbgl/renderer/image_manager.cpp +++ b/src/mbgl/renderer/image_manager.cpp @@ -124,7 +124,7 @@ void ImageManager::getImages(ImageRequestor& requestor, ImageRequestPair&& pair) requestors.emplace(&requestor, std::move(pair)); } } else { - checkMissingAndNotify(requestor, std::move(pair)); + checkMissingAndNotify(requestor, pair); } } diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp index 06eacc041b..a4a73d3fe5 100644 --- a/src/mbgl/renderer/layers/render_symbol_layer.cpp +++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp @@ -67,13 +67,13 @@ struct RenderableSegment { const LayerRenderData& renderData_, const SymbolBucket::PaintProperties& bucketPaintProperties_, float sortKey_, - const SymbolType type_) : - segment(std::move(segment_)), - tile(tile_), - renderData(renderData_), - bucketPaintProperties(bucketPaintProperties_), - sortKey(sortKey_), - type(type_) {} + const SymbolType type_) + : segment(segment_), + tile(tile_), + renderData(renderData_), + bucketPaintProperties(bucketPaintProperties_), + sortKey(sortKey_), + type(type_) {} SegmentWrapper segment; const RenderTile& tile; diff --git a/src/mbgl/renderer/property_evaluation_parameters.hpp b/src/mbgl/renderer/property_evaluation_parameters.hpp index 7c0d4e0fe2..59e96d7849 100644 --- a/src/mbgl/renderer/property_evaluation_parameters.hpp +++ b/src/mbgl/renderer/property_evaluation_parameters.hpp @@ -20,13 +20,8 @@ public: zoomHistory(), defaultFadeDuration(0) {} - PropertyEvaluationParameters(ZoomHistory zoomHistory_, - TimePoint now_, - Duration defaultFadeDuration_) - : z(zoomHistory_.lastZoom), - now(std::move(now_)), - zoomHistory(std::move(zoomHistory_)), - defaultFadeDuration(std::move(defaultFadeDuration_)) {} + PropertyEvaluationParameters(ZoomHistory zoomHistory_, TimePoint now_, Duration defaultFadeDuration_) + : z(zoomHistory_.lastZoom), now(now_), zoomHistory(zoomHistory_), defaultFadeDuration(defaultFadeDuration_) {} CrossfadeParameters getCrossfadeParameters() const { const float fraction = z - std::floor(z); diff --git a/src/mbgl/renderer/render_tile.cpp b/src/mbgl/renderer/render_tile.cpp index 0d63e5b265..70db10fa08 100644 --- a/src/mbgl/renderer/render_tile.cpp +++ b/src/mbgl/renderer/render_tile.cpp @@ -16,9 +16,7 @@ namespace mbgl { using namespace style; -RenderTile::RenderTile(UnwrappedTileID id_, Tile& tile_) - : id(std::move(id_)), tile(tile_) { -} +RenderTile::RenderTile(UnwrappedTileID id_, Tile& tile_) : id(id_), tile(tile_) {} RenderTile::~RenderTile() = default; diff --git a/src/mbgl/renderer/renderer.cpp b/src/mbgl/renderer/renderer.cpp index 916a12a95a..a74a21030e 100644 --- a/src/mbgl/renderer/renderer.cpp +++ b/src/mbgl/renderer/renderer.cpp @@ -8,13 +8,8 @@ namespace mbgl { -Renderer::Renderer(gfx::RendererBackend& backend, - float pixelRatio_, - const optional<std::string> localFontFamily_) - : impl(std::make_unique<Impl>(backend, - pixelRatio_, - std::move(localFontFamily_))) { -} +Renderer::Renderer(gfx::RendererBackend& backend, float pixelRatio_, const optional<std::string> localFontFamily_) + : impl(std::make_unique<Impl>(backend, pixelRatio_, localFontFamily_)) {} Renderer::~Renderer() { gfx::BackendScope guard { impl->backend }; diff --git a/src/mbgl/storage/resource_transform.cpp b/src/mbgl/storage/resource_transform.cpp index a5e62b2c1a..6596551e60 100644 --- a/src/mbgl/storage/resource_transform.cpp +++ b/src/mbgl/storage/resource_transform.cpp @@ -6,8 +6,8 @@ ResourceTransform::ResourceTransform(ActorRef<ResourceTransform>, TransformCallb : transformCallback(std::move(callback)) { } -void ResourceTransform::transform(Resource::Kind kind, const std::string&& url, FinishedCallback&& finished) { - finished(transformCallback(kind, std::move(url))); +void ResourceTransform::transform(Resource::Kind kind, const std::string& url, FinishedCallback&& finished) { + finished(transformCallback(kind, url)); } } // namespace mbgl diff --git a/src/mbgl/style/conversion/source.cpp b/src/mbgl/style/conversion/source.cpp index de41adc89f..980a1a5772 100644 --- a/src/mbgl/style/conversion/source.cpp +++ b/src/mbgl/style/conversion/source.cpp @@ -128,7 +128,7 @@ static optional<std::unique_ptr<Source>> convertGeoJSONSource(const std::string& if (!geoJSON) { return nullopt; } - result->setGeoJSON(std::move(*geoJSON)); + result->setGeoJSON(*geoJSON); } else if (toString(*dataValue)) { result->setURL(*toString(*dataValue)); } else { diff --git a/src/mbgl/style/expression/compound_expression.cpp b/src/mbgl/style/expression/compound_expression.cpp index c2bc511e41..f735f57162 100644 --- a/src/mbgl/style/expression/compound_expression.cpp +++ b/src/mbgl/style/expression/compound_expression.cpp @@ -105,7 +105,7 @@ private: for (std::size_t i = 0; i < sizeof...(Params); ++i) { const EvaluationResult evaluatedArg = args.at(i)->evaluate(evaluationParameters); if (!evaluatedArg) return evaluatedArg.error(); - evaluated[i] = std::move(*evaluatedArg); + evaluated[i] = *evaluatedArg; } const R value = evaluate(*fromExpressionValue<std::decay_t<Params>>(evaluated[I])...); if (!value) return value.error(); @@ -165,7 +165,7 @@ private: for (std::size_t i = 0; i < sizeof...(Params); ++i) { const EvaluationResult evaluatedArg = args.at(i)->evaluate(evaluationParameters); if (!evaluatedArg) return evaluatedArg.error(); - evaluated[i] = std::move(*evaluatedArg); + evaluated[i] = *evaluatedArg; } const R value = evaluate(evaluationParameters, *fromExpressionValue<std::decay_t<Params>>(evaluated[I])...); if (!value) return value.error(); diff --git a/src/mbgl/style/layers/background_layer_properties.cpp b/src/mbgl/style/layers/background_layer_properties.cpp index 749affe2e9..9bf405ab01 100644 --- a/src/mbgl/style/layers/background_layer_properties.cpp +++ b/src/mbgl/style/layers/background_layer_properties.cpp @@ -18,7 +18,7 @@ BackgroundLayerProperties::BackgroundLayerProperties( CrossfadeParameters crossfade_, BackgroundPaintProperties::PossiblyEvaluated evaluated_) : LayerProperties(std::move(impl_)), - crossfade(std::move(crossfade_)), + crossfade(crossfade_), evaluated(std::move(evaluated_)) {} BackgroundLayerProperties::~BackgroundLayerProperties() = default; diff --git a/src/mbgl/style/layers/fill_extrusion_layer_properties.cpp b/src/mbgl/style/layers/fill_extrusion_layer_properties.cpp index cd484ac3cc..e1af47070d 100644 --- a/src/mbgl/style/layers/fill_extrusion_layer_properties.cpp +++ b/src/mbgl/style/layers/fill_extrusion_layer_properties.cpp @@ -18,7 +18,7 @@ FillExtrusionLayerProperties::FillExtrusionLayerProperties( CrossfadeParameters crossfade_, FillExtrusionPaintProperties::PossiblyEvaluated evaluated_) : LayerProperties(std::move(impl_)), - crossfade(std::move(crossfade_)), + crossfade(crossfade_), evaluated(std::move(evaluated_)) {} FillExtrusionLayerProperties::~FillExtrusionLayerProperties() = default; diff --git a/src/mbgl/style/layers/fill_layer_properties.cpp b/src/mbgl/style/layers/fill_layer_properties.cpp index f8f81c900d..c02ae9cc19 100644 --- a/src/mbgl/style/layers/fill_layer_properties.cpp +++ b/src/mbgl/style/layers/fill_layer_properties.cpp @@ -18,7 +18,7 @@ FillLayerProperties::FillLayerProperties( CrossfadeParameters crossfade_, FillPaintProperties::PossiblyEvaluated evaluated_) : LayerProperties(std::move(impl_)), - crossfade(std::move(crossfade_)), + crossfade(crossfade_), evaluated(std::move(evaluated_)) {} FillLayerProperties::~FillLayerProperties() = default; diff --git a/src/mbgl/style/layers/layer_properties.cpp.ejs b/src/mbgl/style/layers/layer_properties.cpp.ejs index 6574950bec..18b07efea8 100644 --- a/src/mbgl/style/layers/layer_properties.cpp.ejs +++ b/src/mbgl/style/layers/layer_properties.cpp.ejs @@ -26,7 +26,7 @@ namespace style { <%- camelize(type) %>PaintProperties::PossiblyEvaluated evaluated_) : LayerProperties(std::move(impl_)), <% if (type === 'background' || type === 'fill' || type === 'line' || type === 'fill-extrusion') { -%> - crossfade(std::move(crossfade_)), + crossfade(crossfade_), <% } -%> evaluated(std::move(evaluated_)) {} diff --git a/src/mbgl/style/layers/line_layer_properties.cpp b/src/mbgl/style/layers/line_layer_properties.cpp index bae5146846..ca346bfa33 100644 --- a/src/mbgl/style/layers/line_layer_properties.cpp +++ b/src/mbgl/style/layers/line_layer_properties.cpp @@ -18,7 +18,7 @@ LineLayerProperties::LineLayerProperties( CrossfadeParameters crossfade_, LinePaintProperties::PossiblyEvaluated evaluated_) : LayerProperties(std::move(impl_)), - crossfade(std::move(crossfade_)), + crossfade(crossfade_), evaluated(std::move(evaluated_)) {} LineLayerProperties::~LineLayerProperties() = default; diff --git a/src/mbgl/style/parser.cpp b/src/mbgl/style/parser.cpp index ae298bd915..b90de3e9b9 100644 --- a/src/mbgl/style/parser.cpp +++ b/src/mbgl/style/parser.cpp @@ -138,7 +138,7 @@ void Parser::parseLight(const JSValue& value) { return; } - light = std::move(*converted); + light = *converted; } void Parser::parseSources(const JSValue& value) { diff --git a/src/mbgl/style/sources/geojson_source.cpp b/src/mbgl/style/sources/geojson_source.cpp index baf76d8224..5171c7c8d9 100644 --- a/src/mbgl/style/sources/geojson_source.cpp +++ b/src/mbgl/style/sources/geojson_source.cpp @@ -12,8 +12,7 @@ namespace mbgl { namespace style { GeoJSONSource::GeoJSONSource(const std::string& id, optional<GeoJSONOptions> options) - : Source(makeMutable<Impl>(std::move(id), options)) { -} + : Source(makeMutable<Impl>(id, options)) {} GeoJSONSource::~GeoJSONSource() = default; @@ -22,7 +21,7 @@ const GeoJSONSource::Impl& GeoJSONSource::impl() const { } void GeoJSONSource::setURL(const std::string& url_) { - url = std::move(url_); + url = url_; // Signal that the source description needs a reload if (loaded || req) { diff --git a/src/mbgl/style/sources/image_source.cpp b/src/mbgl/style/sources/image_source.cpp index baadc86e7c..4c18ae5818 100644 --- a/src/mbgl/style/sources/image_source.cpp +++ b/src/mbgl/style/sources/image_source.cpp @@ -30,7 +30,7 @@ std::array<LatLng, 4> ImageSource::getCoordinates() const { } void ImageSource::setURL(const std::string& url_) { - url = std::move(url_); + url = url_; // Signal that the source description needs a reload if (loaded || req) { loaded = false; diff --git a/src/mbgl/style/sources/image_source_impl.cpp b/src/mbgl/style/sources/image_source_impl.cpp index c1f31dbdc6..7a4f5ac01f 100644 --- a/src/mbgl/style/sources/image_source_impl.cpp +++ b/src/mbgl/style/sources/image_source_impl.cpp @@ -5,15 +5,10 @@ namespace mbgl { namespace style { ImageSource::Impl::Impl(std::string id_, std::array<LatLng, 4> coords_) - : Source::Impl(SourceType::Image, std::move(id_)), - coords(std::move(coords_)) { -} + : Source::Impl(SourceType::Image, std::move(id_)), coords(coords_) {} ImageSource::Impl::Impl(const Impl& other, std::array<LatLng, 4> coords_) - : Source::Impl(other), - coords(std::move(coords_)), - image(other.image) { -} + : Source::Impl(other), coords(coords_), image(other.image) {} ImageSource::Impl::Impl(const Impl& rhs, PremultipliedImage&& image_) : Source::Impl(rhs), diff --git a/src/mbgl/text/collision_feature.hpp b/src/mbgl/text/collision_feature.hpp index 4afecd8e73..8767a5b6f7 100644 --- a/src/mbgl/text/collision_feature.hpp +++ b/src/mbgl/text/collision_feature.hpp @@ -47,8 +47,8 @@ private: class CollisionBox { public: - CollisionBox(Point<float> _anchor, float _x1, float _y1, float _x2, float _y2, float _signedDistanceFromAnchor = 0) : - anchor(std::move(_anchor)), x1(_x1), y1(_y1), x2(_x2), y2(_y2), signedDistanceFromAnchor(_signedDistanceFromAnchor) {} + CollisionBox(Point<float> _anchor, float _x1, float _y1, float _x2, float _y2, float _signedDistanceFromAnchor = 0) + : anchor(_anchor), x1(_x1), y1(_y1), x2(_x2), y2(_y2), signedDistanceFromAnchor(_signedDistanceFromAnchor) {} // the box is centered around the anchor point Point<float> anchor; diff --git a/src/mbgl/text/placement.hpp b/src/mbgl/text/placement.hpp index 662b44d2b0..e2d634c54b 100644 --- a/src/mbgl/text/placement.hpp +++ b/src/mbgl/text/placement.hpp @@ -63,12 +63,8 @@ struct RetainedQueryData { OverscaledTileID tileID; mutable FeatureSortOrder featureSortOrder; - RetainedQueryData(uint32_t bucketInstanceId_, - std::shared_ptr<FeatureIndex> featureIndex_, - OverscaledTileID tileID_) - : bucketInstanceId(bucketInstanceId_) - , featureIndex(std::move(featureIndex_)) - , tileID(std::move(tileID_)) {} + RetainedQueryData(uint32_t bucketInstanceId_, std::shared_ptr<FeatureIndex> featureIndex_, OverscaledTileID tileID_) + : bucketInstanceId(bucketInstanceId_), featureIndex(std::move(featureIndex_)), tileID(tileID_) {} }; class CollisionGroups { diff --git a/src/mbgl/text/quads.hpp b/src/mbgl/text/quads.hpp index 145fd2b153..4435c9aab8 100644 --- a/src/mbgl/text/quads.hpp +++ b/src/mbgl/text/quads.hpp @@ -22,14 +22,14 @@ public: WritingModeType writingMode_, Point<float> glyphOffset_, size_t sectionIndex_ = 0) - : tl(std::move(tl_)), - tr(std::move(tr_)), - bl(std::move(bl_)), - br(std::move(br_)), - tex(std::move(tex_)), - writingMode(writingMode_), - glyphOffset(glyphOffset_), - sectionIndex(sectionIndex_){} + : tl(tl_), + tr(tr_), + bl(bl_), + br(br_), + tex(tex_), + writingMode(writingMode_), + glyphOffset(glyphOffset_), + sectionIndex(sectionIndex_) {} Point<float> tl; Point<float> tr; diff --git a/src/mbgl/text/shaping.hpp b/src/mbgl/text/shaping.hpp index 0e2f5515fe..28730e9db9 100644 --- a/src/mbgl/text/shaping.hpp +++ b/src/mbgl/text/shaping.hpp @@ -27,18 +27,8 @@ class BiDi; class PositionedIcon { private: - PositionedIcon(ImagePosition image_, - float top_, - float bottom_, - float left_, - float right_, - float angle_) - : _image(std::move(image_)), - _top(top_), - _bottom(bottom_), - _left(left_), - _right(right_), - _angle(angle_) {} + PositionedIcon(ImagePosition image_, float top_, float bottom_, float left_, float right_, float angle_) + : _image(image_), _top(top_), _bottom(bottom_), _left(left_), _right(right_), _angle(angle_) {} ImagePosition _image; float _top; diff --git a/src/mbgl/tile/geometry_tile_data.hpp b/src/mbgl/tile/geometry_tile_data.hpp index 5d43a68388..49620982c1 100644 --- a/src/mbgl/tile/geometry_tile_data.hpp +++ b/src/mbgl/tile/geometry_tile_data.hpp @@ -24,8 +24,7 @@ public: template <class... Args> GeometryCoordinates(Args&&... args) : std::vector<GeometryCoordinate>(std::forward<Args>(args)...) {} - GeometryCoordinates(std::initializer_list<GeometryCoordinate> args) - : std::vector<GeometryCoordinate>(std::move(args)) {} + GeometryCoordinates(std::initializer_list<GeometryCoordinate> args) : std::vector<GeometryCoordinate>(args) {} }; class GeometryCollection : public std::vector<GeometryCoordinates> { @@ -33,8 +32,7 @@ public: using coordinate_type = int16_t; template <class... Args> GeometryCollection(Args&&... args) : std::vector<GeometryCoordinates>(std::forward<Args>(args)...) {} - GeometryCollection(std::initializer_list<GeometryCoordinates> args) - : std::vector<GeometryCoordinates>(std::move(args)) {} + GeometryCollection(std::initializer_list<GeometryCoordinates> args) : std::vector<GeometryCoordinates>(args) {} GeometryCollection(GeometryCollection&&) = default; GeometryCollection& operator=(GeometryCollection&&) = default; diff --git a/src/mbgl/tile/geometry_tile_worker.cpp b/src/mbgl/tile/geometry_tile_worker.cpp index f6af61eb3c..7815e62b75 100644 --- a/src/mbgl/tile/geometry_tile_worker.cpp +++ b/src/mbgl/tile/geometry_tile_worker.cpp @@ -37,13 +37,12 @@ GeometryTileWorker::GeometryTileWorker(ActorRef<GeometryTileWorker> self_, const bool showCollisionBoxes_) : self(std::move(self_)), parent(std::move(parent_)), - id(std::move(id_)), + id(id_), sourceID(std::move(sourceID_)), obsolete(obsolete_), mode(mode_), pixelRatio(pixelRatio_), - showCollisionBoxes(showCollisionBoxes_) { -} + showCollisionBoxes(showCollisionBoxes_) {} GeometryTileWorker::~GeometryTileWorker() = default; diff --git a/src/mbgl/tile/tile.cpp b/src/mbgl/tile/tile.cpp index 2ebbf76c2a..441f0424aa 100644 --- a/src/mbgl/tile/tile.cpp +++ b/src/mbgl/tile/tile.cpp @@ -8,8 +8,7 @@ namespace mbgl { static TileObserver nullObserver; -Tile::Tile(Kind kind_, OverscaledTileID id_) : kind(kind_), id(std::move(id_)), observer(&nullObserver) { -} +Tile::Tile(Kind kind_, OverscaledTileID id_) : kind(kind_), id(id_), observer(&nullObserver) {} Tile::~Tile() = default; diff --git a/src/mbgl/tile/vector_tile_data.cpp b/src/mbgl/tile/vector_tile_data.cpp index d53f1deba6..c317525bb9 100644 --- a/src/mbgl/tile/vector_tile_data.cpp +++ b/src/mbgl/tile/vector_tile_data.cpp @@ -23,7 +23,7 @@ FeatureType VectorTileFeature::getType() const { optional<Value> VectorTileFeature::getValue(const std::string& key) const { const optional<Value> value(feature.getValue(key)); - return value->is<NullValue>() ? nullopt : std::move(value); + return value->is<NullValue>() ? nullopt : value; } const PropertyMap& VectorTileFeature::getProperties() const { |