borrow checker

This commit is contained in:
Anatoly Yakovenko 2018-06-23 17:13:45 -07:00 committed by Greg Fitzgerald
parent e929404676
commit 8ef8a8dea7
1 changed files with 2 additions and 2 deletions

View File

@ -561,9 +561,9 @@ impl Crdt {
*cnt += 1; *cnt += 1;
trace!("leader {:?} {}", &v.current_leader_id[..4], *cnt); trace!("leader {:?} {}", &v.current_leader_id[..4], *cnt);
} }
let mut sorted: Vec<_> = table.iter().collect(); let mut sorted: Vec<(&PublicKey, usize)> = table.into_iter().collect();
sorted.sort_by_key(|a| a.1); sorted.sort_by_key(|a| a.1);
sorted.last().map(|a| *(*(*a).0)) sorted.last().map(|a| *a.0)
} }
/// TODO: This is obviously the wrong way to do this. Need to implement leader selection /// TODO: This is obviously the wrong way to do this. Need to implement leader selection