state-res: Remove pointless shifting around of Vec elements

This commit is contained in:
Jonas Platte 2021-08-31 20:40:36 +02:00
parent 9c5b2e3d8c
commit 815fd19a33
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67

View File

@ -192,7 +192,10 @@ impl StateResolution {
state_sets.iter().map(|state_set| state_set.get(key)).collect::<Vec<_>>();
if event_ids.iter().all_equal() {
let id = event_ids.remove(0).expect("unconflicting `EventId` is not None");
// First .unwrap() is okay because
// * event_ids has the same length as state_sets
// * we never enter the loop this code is in if state_sets is empty
let id = event_ids.pop().unwrap().expect("unconflicting `EventId` is not None");
unconflicted_state.insert(key.clone(), id.clone());
} else {
conflicted_state