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"); }