diff --git a/Cargo.toml b/Cargo.toml index 8cf8a4e19..cc774b360 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,6 @@ hyper = "1" hyper-util = { version = "0.1.5", features = ["client-legacy", "server-auto", "http1", "http2", "server-graceful"] } hyper-rustls = { version = "0.27", optional = true, default-features = false, features = ["http1", "http2", "rustls-native-certs", "ring"] } hyper-tls = { version = "0.6.0", optional = true } -itertools = "0.13" log = "0.4" percent-encoding = "2" rustls = { version = "^0.23", optional = true, features = ["ring"] } diff --git a/src/storage.rs b/src/storage.rs index 7870c8276..e820cc2cb 100644 --- a/src/storage.rs +++ b/src/storage.rs @@ -5,7 +5,6 @@ pub use crate::types::TokenInfo; use futures::lock::Mutex; -use itertools::Itertools; use std::collections::HashMap; use std::io; use std::path::{Path, PathBuf}; @@ -138,20 +137,15 @@ impl Storage { Storage::Memory { tokens } => Ok(tokens.lock().await.set(scopes, token)?), Storage::Disk(disk_storage) => Ok(disk_storage.set(scopes, token).await?), Storage::Custom(custom_storage) => { - let str_scopes: Vec<_> = scopes + let mut str_scopes = scopes .scopes .iter() .map(|scope| scope.as_ref()) - .sorted() - .unique() - .collect(); - - custom_storage - .set( - &str_scopes[..], // TODO: sorted, unique - token, - ) - .await + .collect::>(); + str_scopes.sort_unstable(); + str_scopes.dedup(); + + custom_storage.set(&str_scopes[..], token).await } } } @@ -164,13 +158,13 @@ impl Storage { Storage::Memory { tokens } => tokens.lock().await.get(scopes), Storage::Disk(disk_storage) => disk_storage.get(scopes).await, Storage::Custom(custom_storage) => { - let str_scopes: Vec<_> = scopes + let mut str_scopes = scopes .scopes .iter() .map(|scope| scope.as_ref()) - .sorted() - .unique() - .collect(); + .collect::>(); + str_scopes.sort_unstable(); + str_scopes.dedup(); custom_storage.get(&str_scopes[..]).await }