Switched from rustc-hash with ahash

This commit is contained in:
2023-09-04 21:25:43 +03:00
parent 072596a797
commit 3819f68b15
3 changed files with 143 additions and 172 deletions

View File

@ -1,6 +1,5 @@
use crate::prelude::*;
use itertools::Itertools;
use rustc_hash::FxHashSet;
use std::{fmt::Write, path::Path};
use teloxide::{
net::Download,
@ -47,7 +46,7 @@ async fn download_file(bot: &Throttle<Bot>, file: &FileMeta) -> crate::Result<Ve
#[inline]
fn process_accounts(
accounts: &mut [DecryptedAccount],
existing_names: FxHashSet<String>,
existing_names: ahash::HashSet<String>,
) -> crate::Result<Result<(), String>> {
for account in accounts.iter_mut() {
account.name.trim_in_place();
@ -119,7 +118,7 @@ fn process_accounts(
#[inline]
fn user_from_vec(
vector: Vec<u8>,
existing_names: FxHashSet<String>,
existing_names: ahash::HashSet<String>,
) -> crate::Result<Result<User, String>> {
let mut user: User = serde_json::from_slice(&vector)?;
drop(vector);
@ -168,7 +167,7 @@ pub async fn get_user(
let existing_names = async {
Account::get_names(user_id, &db)
.await?
.try_collect::<FxHashSet<_>>()
.try_collect()
.await
.map_err(Into::into)
};