[core] Fix modernize-return-braced-init-list errors
As reported by clang-tidy-8.
This commit is contained in:
@@ -245,7 +245,7 @@ private:
|
||||
|
||||
optional<OnlineFileRequest*> pop() {
|
||||
if (queue.empty()) {
|
||||
return optional<OnlineFileRequest*>();
|
||||
return {};
|
||||
}
|
||||
|
||||
if (queue.begin() == firstLowPriorityRequest) {
|
||||
@@ -254,7 +254,7 @@ private:
|
||||
|
||||
OnlineFileRequest* next = queue.front();
|
||||
queue.pop_front();
|
||||
return optional<OnlineFileRequest*>(next);
|
||||
return {next};
|
||||
}
|
||||
|
||||
bool contains(OnlineFileRequest* request) const {
|
||||
|
||||
@@ -140,7 +140,7 @@ LinePatternPos addDashPattern(AlphaImage& image,
|
||||
|
||||
if (dasharray.size() < 2) {
|
||||
Log::Warning(Event::ParseStyle, "line dasharray requires at least two elements");
|
||||
return LinePatternPos();
|
||||
return {};
|
||||
}
|
||||
|
||||
float length = 0;
|
||||
|
||||
@@ -242,19 +242,17 @@ namespace mbgl {
|
||||
const bool returnTileDistance) {
|
||||
if (symbol.glyphOffsets.empty()) {
|
||||
assert(false);
|
||||
return optional<std::pair<PlacedGlyph, PlacedGlyph>>();
|
||||
return {};
|
||||
}
|
||||
|
||||
const float firstGlyphOffset = symbol.glyphOffsets.front();
|
||||
const float lastGlyphOffset = symbol.glyphOffsets.back();;
|
||||
|
||||
optional<PlacedGlyph> firstPlacedGlyph = placeGlyphAlongLine(fontScale * firstGlyphOffset, lineOffsetX, lineOffsetY, flip, anchorPoint, tileAnchorPoint, symbol.segment, symbol.line, symbol.tileDistances, labelPlaneMatrix, returnTileDistance);
|
||||
if (!firstPlacedGlyph)
|
||||
return optional<std::pair<PlacedGlyph, PlacedGlyph>>();
|
||||
if (!firstPlacedGlyph) return {};
|
||||
|
||||
optional<PlacedGlyph> lastPlacedGlyph = placeGlyphAlongLine(fontScale * lastGlyphOffset, lineOffsetX, lineOffsetY, flip, anchorPoint, tileAnchorPoint, symbol.segment, symbol.line, symbol.tileDistances, labelPlaneMatrix, returnTileDistance);
|
||||
if (!lastPlacedGlyph)
|
||||
return optional<std::pair<PlacedGlyph, PlacedGlyph>>();
|
||||
if (!lastPlacedGlyph) return {};
|
||||
|
||||
return std::make_pair(*firstPlacedGlyph, *lastPlacedGlyph);
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ CameraOptions Map::cameraForLatLngBounds(const LatLngBounds& bounds,
|
||||
|
||||
CameraOptions cameraForLatLngs(const std::vector<LatLng>& latLngs, const Transform& transform, const EdgeInsets& padding) {
|
||||
if (latLngs.empty()) {
|
||||
return CameraOptions();
|
||||
return {};
|
||||
}
|
||||
Size size = transform.getState().getSize();
|
||||
// Calculate the bounds of the possibly rotated shape with respect to the viewport.
|
||||
|
||||
@@ -168,19 +168,18 @@ SymbolTextAndIconProgram::LayoutUniformValues SymbolTextAndIconProgram::layoutUn
|
||||
const TransformState& state,
|
||||
const float symbolFadeChange,
|
||||
const SymbolSDFPart part) {
|
||||
return SymbolTextAndIconProgram::LayoutUniformValues(
|
||||
SymbolSDFProgram<SymbolSDFTextProgram, style::TextPaintProperties>::layoutUniformValues(true,
|
||||
hasVariablePacement,
|
||||
values,
|
||||
texsize,
|
||||
pixelsToGLUnits,
|
||||
pixelRatio,
|
||||
alongLine,
|
||||
tile,
|
||||
state,
|
||||
symbolFadeChange,
|
||||
part)
|
||||
.concat(gfx::UniformValues<SymbolTextAndIconProgramUniforms>(uniforms::texsize::Value(texsize_icon))));
|
||||
return {SymbolSDFProgram<SymbolSDFTextProgram, style::TextPaintProperties>::layoutUniformValues(true,
|
||||
hasVariablePacement,
|
||||
values,
|
||||
texsize,
|
||||
pixelsToGLUnits,
|
||||
pixelRatio,
|
||||
alongLine,
|
||||
tile,
|
||||
state,
|
||||
symbolFadeChange,
|
||||
part)
|
||||
.concat(gfx::UniformValues<SymbolTextAndIconProgramUniforms>(uniforms::texsize::Value(texsize_icon)))};
|
||||
}
|
||||
|
||||
template class SymbolSDFProgram<SymbolSDFIconProgram, style::IconPaintProperties>;
|
||||
|
||||
@@ -25,7 +25,7 @@ EvaluationResult toNumber(const Value& v) {
|
||||
try {
|
||||
return util::stof(s);
|
||||
} catch (...) {
|
||||
return optional<double>();
|
||||
return {};
|
||||
}
|
||||
},
|
||||
[](const auto&) { return optional<double>(); }
|
||||
|
||||
@@ -246,12 +246,10 @@ optional<double> featurePropertyAsDouble(const EvaluationContext& params, const
|
||||
assert(params.feature);
|
||||
auto property = params.feature->getValue(key);
|
||||
if (!property) return {};
|
||||
return property->match(
|
||||
[](double value) { return value; },
|
||||
[](uint64_t value) { return optional<double>(static_cast<double>(value)); },
|
||||
[](int64_t value) { return optional<double>(static_cast<double>(value)); },
|
||||
[](auto) { return optional<double>(); }
|
||||
);
|
||||
return property->match([](double value) { return value; },
|
||||
[](uint64_t value) -> optional<double> { return {static_cast<double>(value)}; },
|
||||
[](int64_t value) -> optional<double> { return {static_cast<double>(value)}; },
|
||||
[](auto) -> optional<double> { return {}; });
|
||||
};
|
||||
|
||||
optional<std::string> featurePropertyAsString(const EvaluationContext& params, const std::string& key) {
|
||||
@@ -267,12 +265,10 @@ optional<std::string> featurePropertyAsString(const EvaluationContext& params, c
|
||||
optional<double> featureIdAsDouble(const EvaluationContext& params) {
|
||||
assert(params.feature);
|
||||
auto id = params.feature->getID();
|
||||
return id.match(
|
||||
[](double value) { return value; },
|
||||
[](uint64_t value) { return optional<double>(static_cast<double>(value)); },
|
||||
[](int64_t value) { return optional<double>(static_cast<double>(value)); },
|
||||
[](auto) { return optional<double>(); }
|
||||
);
|
||||
return id.match([](double value) { return value; },
|
||||
[](uint64_t value) -> optional<double> { return {static_cast<double>(value)}; },
|
||||
[](int64_t value) -> optional<double> { return {static_cast<double>(value)}; },
|
||||
[](auto) -> optional<double> { return {}; });
|
||||
};
|
||||
|
||||
optional<std::string> featureIdAsString(const EvaluationContext& params) {
|
||||
@@ -1160,10 +1156,8 @@ EvaluationResult CompoundExpression::evaluate(const EvaluationContext& evaluatio
|
||||
}
|
||||
|
||||
optional<std::size_t> CompoundExpression::getParameterCount() const {
|
||||
return signature.params.match(
|
||||
[&](const VarargsType&) { return optional<std::size_t>(); },
|
||||
[&](const std::vector<type::Type>& p) -> optional<std::size_t> { return p.size(); }
|
||||
);
|
||||
return signature.params.match([&](const VarargsType&) -> optional<std::size_t> { return {}; },
|
||||
[&](const std::vector<type::Type>& p) -> optional<std::size_t> { return p.size(); });
|
||||
}
|
||||
|
||||
std::vector<optional<Value>> CompoundExpression::possibleOutputs() const {
|
||||
|
||||
@@ -40,14 +40,11 @@ float PropertyExpressionBase::interpolationFactor(const Range<float>& inputLevel
|
||||
|
||||
Range<float> PropertyExpressionBase::getCoveringStops(const float lower, const float upper) const noexcept {
|
||||
return zoomCurve.match(
|
||||
[](std::nullptr_t) {
|
||||
[](std::nullptr_t) -> Range<float> {
|
||||
assert(false);
|
||||
return Range<float>(0.0f, 0.0f);
|
||||
return {0.0f, 0.0f};
|
||||
},
|
||||
[&](auto z) {
|
||||
return z->getCoveringStops(lower, upper);
|
||||
}
|
||||
);
|
||||
[&](auto z) { return z->getCoveringStops(lower, upper); });
|
||||
}
|
||||
|
||||
const expression::Expression& PropertyExpressionBase::getExpression() const noexcept {
|
||||
|
||||
@@ -285,8 +285,8 @@ PotentialBreak evaluateBreak(const std::size_t breakIndex, const float breakX, c
|
||||
bestBreakBadness = breakBadness;
|
||||
}
|
||||
}
|
||||
|
||||
return PotentialBreak(breakIndex, breakX, bestPriorBreak, bestBreakBadness);
|
||||
|
||||
return {breakIndex, breakX, bestPriorBreak, bestBreakBadness};
|
||||
}
|
||||
|
||||
std::set<std::size_t> leastBadBreaks(const PotentialBreak& lastLineBreak) {
|
||||
|
||||
Reference in New Issue
Block a user