From 06da34c027c760c1fe714ba2ee56d433e0facec0 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Thu, 26 Oct 2023 20:13:00 -0400 Subject: [PATCH] remove unneeded btree sorting (#970) --- martin/src/source.rs | 2 -- martin/src/sprites/mod.rs | 2 -- martin/src/utils/utilities.rs | 4 +--- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/martin/src/source.rs b/martin/src/source.rs index f78d69d9..2c0e246e 100644 --- a/martin/src/source.rs +++ b/martin/src/source.rs @@ -3,7 +3,6 @@ use std::fmt::Debug; use actix_web::error::ErrorNotFound; use async_trait::async_trait; -use itertools::Itertools; use log::debug; use martin_tile_utils::TileInfo; use serde::{Deserialize, Serialize}; @@ -38,7 +37,6 @@ impl TileSources { self.0 .iter() .map(|(id, src)| (id.to_string(), src.get_catalog_entry())) - .sorted_by(|(id1, _), (id2, _)| id1.cmp(id2)) .collect() } diff --git a/martin/src/sprites/mod.rs b/martin/src/sprites/mod.rs index ac2b3f4a..dc205d6c 100644 --- a/martin/src/sprites/mod.rs +++ b/martin/src/sprites/mod.rs @@ -4,7 +4,6 @@ use std::fmt::Debug; use std::path::PathBuf; use futures::future::try_join_all; -use itertools::Itertools; use log::{info, warn}; use serde::{Deserialize, Serialize}; use spreet::fs::get_svg_input_paths; @@ -93,7 +92,6 @@ impl SpriteSources { Ok(self .0 .iter() - .sorted_by(|(id1, _), (id2, _)| id1.cmp(id2)) .map(|(id, source)| { let mut images = get_svg_input_paths(&source.path, true) .into_iter() diff --git a/martin/src/utils/utilities.rs b/martin/src/utils/utilities.rs index e3a83f35..a8eab5b2 100644 --- a/martin/src/utils/utilities.rs +++ b/martin/src/utils/utilities.rs @@ -18,9 +18,7 @@ pub fn sorted_opt_map( } pub fn sorted_btree_map(value: &HashMap) -> BTreeMap<&K, &V> { - let mut items: Vec<(_, _)> = value.iter().collect(); - items.sort_by(|a, b| a.0.cmp(b.0)); - BTreeMap::from_iter(items) + value.iter().collect() } #[cfg(test)]