Introduce a collections crate w/ deterministic hashmap, hashset in tests

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2021-11-29 15:22:45 -08:00
parent 5ec003530f
commit 1a91aa8194
8 changed files with 59 additions and 42 deletions

View file

@ -8,6 +8,7 @@ use super::{
use anyhow::anyhow;
use async_std::task;
use async_tungstenite::{tungstenite::protocol::Role, WebSocketStream};
use collections::{HashMap, HashSet};
use futures::{future::BoxFuture, FutureExt};
use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard};
use postage::{mpsc, prelude::Sink as _, prelude::Stream as _};
@ -16,14 +17,7 @@ use rpc::{
Connection, ConnectionId, Peer, TypedEnvelope,
};
use sha1::{Digest as _, Sha1};
use std::{
any::TypeId,
collections::{HashMap, HashSet},
future::Future,
mem,
sync::Arc,
time::Instant,
};
use std::{any::TypeId, future::Future, mem, sync::Arc, time::Instant};
use store::{Store, Worktree};
use surf::StatusCode;
use tide::log;
@ -220,7 +214,7 @@ impl Server {
let receipt = request.receipt();
let host_user_id = self.state().user_id_for_connection(request.sender_id)?;
let mut contact_user_ids = HashSet::new();
let mut contact_user_ids = HashSet::default();
contact_user_ids.insert(host_user_id);
for github_login in request.payload.authorized_logins {
match self.app_state.db.create_user(&github_login, false).await {