From c442dfd1ad4896e7abeeaac1754b94bae1f8d014 Mon Sep 17 00:00:00 2001 From: EdJoPaTo Date: Wed, 24 Apr 2024 10:49:57 +0200 Subject: [PATCH] perf(canvas): change map data to const instead of static (#1037) --- src/widgets/canvas/map.rs | 2 +- src/widgets/canvas/world.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/widgets/canvas/map.rs b/src/widgets/canvas/map.rs index be66e06754..c6551b54ef 100644 --- a/src/widgets/canvas/map.rs +++ b/src/widgets/canvas/map.rs @@ -27,7 +27,7 @@ pub enum MapResolution { } impl MapResolution { - fn data(self) -> &'static [(f64, f64)] { + const fn data(self) -> &'static [(f64, f64)] { match self { Self::Low => &WORLD_LOW_RESOLUTION, Self::High => &WORLD_HIGH_RESOLUTION, diff --git a/src/widgets/canvas/world.rs b/src/widgets/canvas/world.rs index d8bd3775c8..fe0a475cd4 100644 --- a/src/widgets/canvas/world.rs +++ b/src/widgets/canvas/world.rs @@ -1,5 +1,5 @@ /// [Source data](http://www.gnuplotting.org/plotting-the-world-revisited) -pub static WORLD_HIGH_RESOLUTION: [(f64, f64); 5125] = [ +pub const WORLD_HIGH_RESOLUTION: [(f64, f64); 5125] = [ (-163.7128, -78.5956), (-163.1058, -78.2233), (-161.2451, -78.3801), @@ -5127,7 +5127,7 @@ pub static WORLD_HIGH_RESOLUTION: [(f64, f64); 5125] = [ (180.0, -84.71338), ]; -pub static WORLD_LOW_RESOLUTION: [(f64, f64); 1166] = [ +pub const WORLD_LOW_RESOLUTION: [(f64, f64); 1166] = [ (-92.32, 48.24), (-88.13, 48.92), (-83.11, 46.27),