From e7c11adc978f04f84c20f22704e95e18e5f21ab7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 28 Jan 2025 04:16:02 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- platform/rust/build.rs | 10 ++++++---- platform/rust/src/lib.rs | 14 +++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/platform/rust/build.rs b/platform/rust/build.rs index 538bc4dad1f..6e7c92c83cb 100644 --- a/platform/rust/build.rs +++ b/platform/rust/build.rs @@ -4,8 +4,10 @@ use std::path::PathBuf; fn main() { let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); let project_root = PathBuf::from(manifest_dir) - .parent().unwrap() // "platform/" - .parent().unwrap() // "maplibre-native/" + .parent() + .unwrap() // "platform/" + .parent() + .unwrap() // "maplibre-native/" .to_path_buf(); let mut cmake_cfg = cmake::Config::new(&project_root); @@ -26,6 +28,6 @@ fn main() { // cxx build let mut cxx = cxx_build::bridge("src/lib.rs"); cxx.include(project_root.join("include")) - .flag_if_supported("-std=c++20") - .compile("maplibre_rust_bindings"); + .flag_if_supported("-std=c++20") + .compile("maplibre_rust_bindings"); } diff --git a/platform/rust/src/lib.rs b/platform/rust/src/lib.rs index c4e24b088f4..e47d74f11c2 100644 --- a/platform/rust/src/lib.rs +++ b/platform/rust/src/lib.rs @@ -8,11 +8,11 @@ mod ffi { // We specify the C++ namespace and the free function name exactly. // cxx can bind free functions directly if they have a compatible signature. - // The signature must match what's in log2.hpp: - // "uint32_t ceil_log2(uint64_t x);" - // - // We'll express that to Rust as (u64 -> u32). - pub fn ceil_log2(x: u64) -> u32; + // The signature must match what's in log2.hpp: + // "uint32_t ceil_log2(uint64_t x);" + // + // We'll express that to Rust as (u64 -> u32). + pub fn ceil_log2(x: u64) -> u32; } } @@ -28,10 +28,10 @@ mod tests { fn test_log2() { let result = ceil_log2(1); assert_eq!(result, 0, "log2(1) = 0 bits needed"); - + let result = ceil_log2(2); assert_eq!(result, 1, "log2(2) = 1 bit needed"); - + let result = ceil_log2(3); assert_eq!(result, 2, "log2(3) -> 2 bits needed"); }