state-res: Only depend on maplit for tests / benches
This commit is contained in:
parent
a3707b1a3a
commit
9c5b2e3d8c
@ -21,7 +21,6 @@ unstable-exhaustive-types = []
|
||||
[dependencies]
|
||||
itertools = "0.10.0"
|
||||
js_int = "0.2.0"
|
||||
maplit = "1.0.2"
|
||||
ruma-common = { version = "0.6.0", path = "../ruma-common" }
|
||||
ruma-events = { version = "0.24.5", path = "../ruma-events" }
|
||||
ruma-identifiers = { version = "0.20.0", path = "../ruma-identifiers" }
|
||||
@ -33,6 +32,7 @@ tracing = "0.1.26"
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = "0.3.3"
|
||||
maplit = "1.0.2"
|
||||
rand = "0.8.3"
|
||||
tracing-subscriber = "0.2.15"
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
use std::{convert::TryFrom, sync::Arc};
|
||||
use std::{collections::BTreeSet, convert::TryFrom, sync::Arc};
|
||||
|
||||
use js_int::int;
|
||||
use maplit::btreeset;
|
||||
use ruma_events::{
|
||||
room::{
|
||||
create::CreateEventContent,
|
||||
@ -572,7 +571,7 @@ where
|
||||
|
||||
let user_level = get_user_power_level(power_event.sender(), fetch_state);
|
||||
|
||||
let mut user_levels_to_check = btreeset![];
|
||||
let mut user_levels_to_check = BTreeSet::new();
|
||||
let old_list = ¤t_content.users;
|
||||
let user_list = &user_content.users;
|
||||
for user in old_list.keys().chain(user_list.keys()) {
|
||||
@ -582,7 +581,7 @@ where
|
||||
|
||||
debug!("users to check {:?}", user_levels_to_check);
|
||||
|
||||
let mut event_levels_to_check = btreeset![];
|
||||
let mut event_levels_to_check = BTreeSet::new();
|
||||
let old_list = ¤t_content.events;
|
||||
let new_list = &user_content.events;
|
||||
for ev_id in old_list.keys().chain(new_list.keys()) {
|
||||
|
@ -5,7 +5,6 @@ use std::{
|
||||
};
|
||||
|
||||
use itertools::Itertools;
|
||||
use maplit::hashset;
|
||||
use ruma_common::MilliSecondsSinceUnixEpoch;
|
||||
use ruma_events::{
|
||||
room::{
|
||||
@ -217,7 +216,7 @@ impl StateResolution {
|
||||
|
||||
Ok(auth_chain_sets.into_iter().flatten().filter(|id| !common.contains(id)).collect())
|
||||
} else {
|
||||
Ok(hashset![])
|
||||
Ok(HashSet::new())
|
||||
}
|
||||
}
|
||||
|
||||
@ -303,7 +302,7 @@ impl StateResolution {
|
||||
|
||||
// The number of events that depend on the given event (the EventId key)
|
||||
// How many events reference this event in the DAG as a parent
|
||||
let mut reverse_graph = HashMap::new();
|
||||
let mut reverse_graph: HashMap<&EventId, HashSet<&EventId>> = HashMap::new();
|
||||
|
||||
// Vec of nodes that have zero out degree, least recent events.
|
||||
let mut zero_outdegree = vec![];
|
||||
@ -315,9 +314,9 @@ impl StateResolution {
|
||||
zero_outdegree.push(Reverse((key_fn(node)?, node)));
|
||||
}
|
||||
|
||||
reverse_graph.entry(node).or_insert(hashset![]);
|
||||
reverse_graph.entry(node).or_default();
|
||||
for edge in edges {
|
||||
reverse_graph.entry(edge).or_insert(hashset![]).insert(node);
|
||||
reverse_graph.entry(edge).or_default().insert(node);
|
||||
}
|
||||
}
|
||||
|
||||
@ -615,7 +614,7 @@ impl StateResolution {
|
||||
{
|
||||
let mut state = vec![event_id.clone()];
|
||||
while let Some(eid) = state.pop() {
|
||||
graph.entry(eid.clone()).or_insert(hashset![]);
|
||||
graph.entry(eid.clone()).or_default();
|
||||
// Prefer the store to event as the store filters dedups the events
|
||||
for aid in &fetch_event(&eid).map(|ev| ev.auth_events()).unwrap_or_default() {
|
||||
if auth_diff.contains(aid) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user