state-res: Simplify get_auth_chain_diff signature
It never returned Err(_), so the return type shouldn't be Result<_>.
This commit is contained in:
parent
290c61820b
commit
324fb58a62
@ -79,7 +79,7 @@ where
|
||||
debug!("{:?}", conflicting);
|
||||
|
||||
// The set of auth events that are not common across server forks
|
||||
let mut auth_diff = get_auth_chain_diff(auth_chain_sets)?;
|
||||
let mut auth_diff = get_auth_chain_diff(auth_chain_sets);
|
||||
|
||||
// Add the auth_diff to conflicting now we have a full set of conflicting events
|
||||
auth_diff.extend(conflicting.values().cloned().flatten().flatten());
|
||||
@ -195,16 +195,16 @@ pub fn separate(
|
||||
}
|
||||
|
||||
/// Returns a Vec of deduped EventIds that appear in some chains but not others.
|
||||
pub fn get_auth_chain_diff(auth_chain_sets: Vec<HashSet<EventId>>) -> Result<HashSet<EventId>> {
|
||||
pub fn get_auth_chain_diff(auth_chain_sets: Vec<HashSet<EventId>>) -> HashSet<EventId> {
|
||||
if let Some(first) = auth_chain_sets.first().cloned() {
|
||||
let common = auth_chain_sets
|
||||
.iter()
|
||||
.skip(1)
|
||||
.fold(first, |a, b| a.intersection(b).cloned().collect::<HashSet<EventId>>());
|
||||
|
||||
Ok(auth_chain_sets.into_iter().flatten().filter(|id| !common.contains(id)).collect())
|
||||
auth_chain_sets.into_iter().flatten().filter(|id| !common.contains(id)).collect()
|
||||
} else {
|
||||
Ok(HashSet::new())
|
||||
HashSet::new()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user