Skip to content

Commit

Permalink
remove unneeded btree sorting (#970)
Browse files Browse the repository at this point in the history
  • Loading branch information
nyurik authored Oct 27, 2023
1 parent 94f2c16 commit 06da34c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 7 deletions.
2 changes: 0 additions & 2 deletions martin/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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()
}

Expand Down
2 changes: 0 additions & 2 deletions martin/src/sprites/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 1 addition & 3 deletions martin/src/utils/utilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit 06da34c

Please sign in to comment.