[core] Fix google-explicit-constructor errors

As reported by clang-tidy-8.
This commit is contained in:
Thiago Marcos P. Santos
2020-03-27 17:43:37 +02:00
parent 65f4df5190
commit 62b543e44a
10 changed files with 12 additions and 20 deletions

View File

@@ -19,7 +19,7 @@ namespace mbgl {
class LocalFileSource::Impl {
public:
Impl(const ActorRef<Impl>&) {}
explicit Impl(const ActorRef<Impl>&) {}
void request(const std::string& url, const ActorRef<FileSourceRequest>& req) {
if (!acceptsURL(url)) {

View File

@@ -46,9 +46,7 @@ void setTempPath(const std::string& path) {
class DatabaseImpl {
public:
DatabaseImpl(sqlite3* db_)
: db(db_)
{
explicit DatabaseImpl(sqlite3* db_) : db(db_) {
const int error = sqlite3_extended_result_codes(db, true);
if (error != SQLITE_OK) {
mbgl::Log::Warning(mbgl::Event::Database, error, "Failed to enable extended result codes: %s", sqlite3_errmsg(db));

View File

@@ -12,10 +12,7 @@ namespace util {
class AsyncTask::Impl {
public:
Impl(std::function<void()>&& fn)
: async(new uv_async_t),
task(std::move(fn)) {
explicit Impl(std::function<void()> fn) : async(new uv_async_t), task(std::move(fn)) {
auto* loop = reinterpret_cast<uv_loop_t*>(RunLoop::getLoopHandle());
if (uv_async_init(loop, async, asyncCallback) != 0) {
throw std::runtime_error("Failed to initialize async.");

View File

@@ -79,8 +79,7 @@ static void on_error_message(j_common_ptr cinfo) {
}
struct jpeg_info_guard {
jpeg_info_guard(jpeg_decompress_struct* cinfo)
: i_(cinfo) {}
explicit jpeg_info_guard(jpeg_decompress_struct* cinfo) : i_(cinfo) {}
~jpeg_info_guard() {
jpeg_destroy_decompress(i_);

View File

@@ -7,8 +7,7 @@
class GLFWGLRenderableResource final : public mbgl::gl::RenderableResource {
public:
GLFWGLRenderableResource(GLFWGLBackend& backend_) : backend(backend_) {
}
explicit GLFWGLRenderableResource(GLFWGLBackend& backend_) : backend(backend_) {}
void bind() override {
backend.setFramebufferBinding(0);

View File

@@ -20,7 +20,7 @@ public:
class SetCamera final : public TestOperationSerializer {
public:
SetCamera(mbgl::CameraOptions camera_) : camera(std::move(camera_)) {}
explicit SetCamera(mbgl::CameraOptions camera_) : camera(std::move(camera_)) {}
void serialize(Writer& writer) const override {
if (camera.zoom) {
@@ -59,7 +59,7 @@ private:
class SetStyle final : public TestOperationSerializer {
public:
SetStyle(const mbgl::style::Style& style) : url(style.getURL()) {}
explicit SetStyle(const mbgl::style::Style& style) : url(style.getURL()) {}
void serialize(Writer& writer) const override {
writer.StartArray();
@@ -74,7 +74,7 @@ private:
class SetInitialSize final : public TestOperationSerializer {
public:
SetInitialSize(const mbgl::Size& size) : width(size.width), height(size.height) {}
explicit SetInitialSize(const mbgl::Size& size) : width(size.width), height(size.height) {}
void serialize(Writer& writer) const override {
writer.Key("width");

View File

@@ -17,7 +17,7 @@ private:
struct Key { explicit Key() = default; };
public:
GLXDisplayConfig(Key) {
explicit GLXDisplayConfig(Key) {
if (!XInitThreads()) {
throw std::runtime_error("Failed to XInitThreads.");
}

View File

@@ -70,8 +70,7 @@ const GeometryCollection& AnnotationTileFeature::getGeometries() const {
class AnnotationTileLayerData {
public:
AnnotationTileLayerData(std::string name_) : name(std::move(name_)) {
}
explicit AnnotationTileLayerData(std::string name_) : name(std::move(name_)) {}
const std::string name;
std::vector<std::shared_ptr<const AnnotationTileFeatureData>> features;

View File

@@ -33,7 +33,7 @@ bool operator==(const VarargsType& lhs, const VarargsType& rhs) {
template <typename T>
struct Varargs : std::vector<T> {
template <class... Args>
Varargs(Args&&... args) : std::vector<T>(std::forward<Args>(args)...) {}
explicit Varargs(Args&&... args) : std::vector<T>(std::forward<Args>(args)...) {}
};
namespace detail {

View File

@@ -12,7 +12,7 @@ public:
const Feature& feature;
mutable optional<GeometryCollection> geometry;
GeoJSONFeature(const Feature& feature_) : feature(feature_) {}
explicit GeoJSONFeature(const Feature& feature_) : feature(feature_) {}
GeoJSONFeature(const Feature& feature_, const CanonicalTileID& canonical) : feature(feature_) {
geometry = convertGeometry(feature.geometry, canonical);
// https://github.com/mapbox/geojson-vt-cpp/issues/44