From 54a07f4b9c047f24284b593913fa70f2b9c2fb8b Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Wed, 24 Apr 2024 06:56:10 +0200 Subject: [PATCH] Update clang-format (pre-commit) (#2312) --- .pre-commit-config.yaml | 5 +++-- include/mbgl/gl/buffer_allocator.hpp | 2 +- include/mbgl/util/scoped.hpp | 2 +- include/mbgl/util/tileset.hpp | 2 +- .../android/MapLibreAndroid/src/cpp/http_file_source.cpp | 2 +- .../MapLibreAndroid/src/cpp/snapshotter/map_snapshot.hpp | 2 +- platform/node/src/node_expression.hpp | 2 +- src/mbgl/annotation/annotation_manager.cpp | 2 +- test/actor/actor.test.cpp | 8 ++++---- 9 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aa99f1097..550aa2e5f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ repos: - id: check-yaml args: [--allow-multiple-documents] - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v18.1.3 + rev: v18.1.4 hooks: - id: clang-format files: '.*\.(hpp|cpp|h)' @@ -21,4 +21,5 @@ repos: additional_dependencies: [shellcheck-py] ci: # sometimes fails https://github.com/keith/pre-commit-buildifier/issues/13 - skip: [buildifier] \ No newline at end of file + skip: [buildifier] + diff --git a/include/mbgl/gl/buffer_allocator.hpp b/include/mbgl/gl/buffer_allocator.hpp index 246a0f4ff..2b2736d34 100644 --- a/include/mbgl/gl/buffer_allocator.hpp +++ b/include/mbgl/gl/buffer_allocator.hpp @@ -38,7 +38,7 @@ private: /// @brief IBufferAllocator hides the underlying implementation of the buffer allocator scheme used. class IBufferAllocator { public: - virtual ~IBufferAllocator(){}; + virtual ~IBufferAllocator() {}; /// @brief Write data into a buffer managed by the allocator /// @param data Pointer to data to write into the buffer diff --git a/include/mbgl/util/scoped.hpp b/include/mbgl/util/scoped.hpp index 407663719..92a793638 100644 --- a/include/mbgl/util/scoped.hpp +++ b/include/mbgl/util/scoped.hpp @@ -6,7 +6,7 @@ namespace mbgl { template struct Scoped { Scoped(Func&& fn) - : cb(std::move(fn)){}; + : cb(std::move(fn)) {}; ~Scoped() { cb(); } Scoped(const Scoped&) = delete; diff --git a/include/mbgl/util/tileset.hpp b/include/mbgl/util/tileset.hpp index 5019be04f..d2fd0b811 100644 --- a/include/mbgl/util/tileset.hpp +++ b/include/mbgl/util/tileset.hpp @@ -40,7 +40,7 @@ public: zoomRange(zoomRange_), attribution(std::move(attribution_)), scheme(scheme_), - encoding(encoding_){}; + encoding(encoding_) {}; // TileJSON also includes center and zoom but they are not used by mbgl. diff --git a/platform/android/MapLibreAndroid/src/cpp/http_file_source.cpp b/platform/android/MapLibreAndroid/src/cpp/http_file_source.cpp index f0c5c219d..92420ca7d 100644 --- a/platform/android/MapLibreAndroid/src/cpp/http_file_source.cpp +++ b/platform/android/MapLibreAndroid/src/cpp/http_file_source.cpp @@ -20,7 +20,7 @@ class HTTPFileSource::Impl { public: Impl(const ResourceOptions resourceOptions_, const ClientOptions clientOptions_) : resourceOptions(resourceOptions_.clone()), - clientOptions(clientOptions_.clone()){}; + clientOptions(clientOptions_.clone()) {}; android::UniqueEnv env{android::AttachEnv()}; diff --git a/platform/android/MapLibreAndroid/src/cpp/snapshotter/map_snapshot.hpp b/platform/android/MapLibreAndroid/src/cpp/snapshotter/map_snapshot.hpp index 02a4f07f5..ffc1b2b6e 100644 --- a/platform/android/MapLibreAndroid/src/cpp/snapshotter/map_snapshot.hpp +++ b/platform/android/MapLibreAndroid/src/cpp/snapshotter/map_snapshot.hpp @@ -30,7 +30,7 @@ public: PointForFn pointForFn, LatLngForFn latLngForFn); - MapSnapshot(jni::JNIEnv&){}; + MapSnapshot(jni::JNIEnv&) {}; MapSnapshot(float pixelRatio, PointForFn, LatLngForFn); ~MapSnapshot(); diff --git a/platform/node/src/node_expression.hpp b/platform/node/src/node_expression.hpp index 4b93b59d5..cf1d2c919 100644 --- a/platform/node/src/node_expression.hpp +++ b/platform/node/src/node_expression.hpp @@ -21,7 +21,7 @@ public: private: NodeExpression(std::unique_ptr expression_) - : expression(std::move(expression_)){}; + : expression(std::move(expression_)) {}; static void New(const Nan::FunctionCallbackInfo&); static void Parse(const Nan::FunctionCallbackInfo&); diff --git a/src/mbgl/annotation/annotation_manager.cpp b/src/mbgl/annotation/annotation_manager.cpp index 381680a9c..2c6dd2218 100644 --- a/src/mbgl/annotation/annotation_manager.cpp +++ b/src/mbgl/annotation/annotation_manager.cpp @@ -37,7 +37,7 @@ const std::string AnnotationManager::PointLayerID = "com.mapbox.annotations.poin const std::string AnnotationManager::ShapeLayerID = "com.mapbox.annotations.shape."; AnnotationManager::AnnotationManager(Style& style_) - : style(style_){}; + : style(style_) {}; AnnotationManager::~AnnotationManager() = default; diff --git a/test/actor/actor.test.cpp b/test/actor/actor.test.cpp index 70e5f7048..e0558f280 100644 --- a/test/actor/actor.test.cpp +++ b/test/actor/actor.test.cpp @@ -27,7 +27,7 @@ TEST(Actor, Construction) { TEST(Actor, Destruction) { struct TestActor { TestActor(ActorRef, bool& destructed_) - : destructed(destructed_){}; + : destructed(destructed_) {}; ~TestActor() { destructed = true; } bool& destructed; @@ -136,7 +136,7 @@ TEST(Actor, DestructionAllowedInReceiveOnSameThread) { // allows for self-closing actors struct TestActor { - TestActor(ActorRef){}; + TestActor(ActorRef) {}; void callMeBack(std::function callback) { callback(); } }; @@ -162,7 +162,7 @@ TEST(Actor, SelfDestructionDoesntCrashWaitingReceivingThreads) { // callback struct TestActor { - TestActor(ActorRef){}; + TestActor(ActorRef) {}; void callMeBack(std::function callback) { callback(); } }; @@ -334,7 +334,7 @@ TEST(Actor, TwoPhaseConstruction) { struct TestActor { TestActor(ActorRef, std::shared_ptr destroyed_) - : destroyed(std::move(destroyed_)){}; + : destroyed(std::move(destroyed_)) {}; ~TestActor() { *destroyed = true; }