remove unneeded btree sorting (#970)

This commit is contained in:
Yuri Astrakhan 2023-10-26 20:13:00 -04:00 committed by GitHub
parent 94f2c16267
commit 06da34c027
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 7 deletions

View File

@ -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()
}

View File

@ -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()

View File

@ -18,9 +18,7 @@ pub fn sorted_opt_map<S: Serializer, T: Serialize>(
}
pub fn sorted_btree_map<K: Serialize + Ord, V>(value: &HashMap<K, V>) -> 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)]