Skip to content

Commit

Permalink
use more str to save literally hundreds of extra bytes!!! wow
Browse files Browse the repository at this point in the history
  • Loading branch information
gburgessiv committed May 27, 2023
1 parent e231cf9 commit 866b209
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/discord.rs
Expand Up @@ -240,7 +240,7 @@ struct ServerUIMessage {
struct BlamelistCache {
email_id_mappings: HashMap<Email, Vec<UserId>>,
// Cache of User ID -> Optional nickname
known_guild_members: Option<HashMap<UserId, Option<String>>>,
known_guild_members: Option<HashMap<UserId, Option<Box<str>>>>,
}

impl BlamelistCache {
Expand All @@ -257,11 +257,11 @@ impl BlamelistCache {
}

if self.known_guild_members.is_none() {
let mut r: HashMap<UserId, Option<String>> = HashMap::new();
let mut r: HashMap<UserId, Option<Box<str>>> = HashMap::new();
let mut members_iter = guild.members_iter(http).boxed();
while let Some(member) = members_iter.next().await {
let member = member?;
r.insert(member.user.id, member.nick.clone());
r.insert(member.user.id, member.nick.map(|x| x.into_boxed_str()));
}
info!("Fetched {} members from #{}", r.len(), guild);
self.known_guild_members = Some(r);
Expand Down

0 comments on commit 866b209

Please sign in to comment.