From a9717d570d467734098f9bcf588ae97937676120 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sat, 7 Feb 2026 19:19:17 +0000 Subject: [PATCH] Format --- server-rs/src/metrics.rs | 5 ++++- server-rs/src/parsing/bounds.rs | 5 ++++- server-rs/src/routes/features.rs | 2 +- server-rs/src/routes/tiles.rs | 10 +++++++--- server-rs/src/utils/grid_index.rs | 16 ++++++++++++---- 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/server-rs/src/metrics.rs b/server-rs/src/metrics.rs index 46ddf04..c4c97a6 100644 --- a/server-rs/src/metrics.rs +++ b/server-rs/src/metrics.rs @@ -58,7 +58,10 @@ pub async fn metrics_handler(handle: PrometheusHandle) -> impl IntoResponse { match handle.render() { output if !output.is_empty() => (StatusCode::OK, output), - _ => (StatusCode::INTERNAL_SERVER_ERROR, "Failed to render metrics".to_string()), + _ => ( + StatusCode::INTERNAL_SERVER_ERROR, + "Failed to render metrics".to_string(), + ), } } diff --git a/server-rs/src/parsing/bounds.rs b/server-rs/src/parsing/bounds.rs index b825b3f..34732a7 100644 --- a/server-rs/src/parsing/bounds.rs +++ b/server-rs/src/parsing/bounds.rs @@ -72,7 +72,10 @@ pub fn parse_bounds(bounds_str: &str) -> Result<(f64, f64, f64, f64), (StatusCod if south > north { return Err(( StatusCode::BAD_REQUEST, - format!("Invalid bounds: south ({}) must be <= north ({})", south, north), + format!( + "Invalid bounds: south ({}) must be <= north ({})", + south, north + ), )); } if west > east { diff --git a/server-rs/src/routes/features.rs b/server-rs/src/routes/features.rs index b434b7d..34bbda0 100644 --- a/server-rs/src/routes/features.rs +++ b/server-rs/src/routes/features.rs @@ -35,7 +35,7 @@ pub enum FeatureInfo { #[derive(Clone, Serialize)] pub struct FeatureGroupResponse { name: String, - features: Vec, + pub(crate) features: Vec, } #[derive(Clone, Serialize)] diff --git a/server-rs/src/routes/tiles.rs b/server-rs/src/routes/tiles.rs index 252d9cd..c65ccf9 100644 --- a/server-rs/src/routes/tiles.rs +++ b/server-rs/src/routes/tiles.rs @@ -89,9 +89,13 @@ pub async fn get_style( fn build_style(is_dark: bool, layers: &[serde_json::Value], tile_url: &str) -> serde_json::Value { let (bg_color, water_color, land_color, road_color, text_color, text_halo) = if is_dark { - ("#1a1a1a", "#193447", "#1a1a1a", "#2a2a2a", "#888888", "#000000") + ( + "#1a1a1a", "#193447", "#1a1a1a", "#2a2a2a", "#888888", "#000000", + ) } else { - ("#f8f4f0", "#aad3df", "#f8f4f0", "#ffffff", "#333333", "#ffffff") + ( + "#f8f4f0", "#aad3df", "#f8f4f0", "#ffffff", "#333333", "#ffffff", + ) }; // Build layer list from metadata @@ -238,7 +242,7 @@ fn build_style(is_dark: bool, layers: &[serde_json::Value], tile_url: &str) -> s serde_json::json!({ "version": 8, "name": if is_dark { "Dark" } else { "Light" }, - "glyphs": "https://protomaps.github.io/basemaps-assets/fonts/{fontstack}/{range}.pbf", + "glyphs": "/assets/fonts/{fontstack}/{range}.pbf", "sources": { "protomaps": { "type": "vector", diff --git a/server-rs/src/utils/grid_index.rs b/server-rs/src/utils/grid_index.rs index 99128e8..5a94038 100644 --- a/server-rs/src/utils/grid_index.rs +++ b/server-rs/src/utils/grid_index.rs @@ -42,10 +42,18 @@ impl GridIndex { for index in 0..lat.len() { let la = lat[index]; let lo = lon[index]; - if la < min_lat { min_lat = la; } - if la > max_lat { max_lat = la; } - if lo < min_lon { min_lon = lo; } - if lo > max_lon { max_lon = lo; } + if la < min_lat { + min_lat = la; + } + if la > max_lat { + max_lat = la; + } + if lo < min_lon { + min_lon = lo; + } + if lo > max_lon { + max_lon = lo; + } } min_lat -= cell_size;