File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -488,7 +488,7 @@ impl SyncProgress {
488488 }
489489
490490 fn is_ready ( & self ) -> bool {
491- self . complete == true || self . failed . is_some ( )
491+ self . complete || self . failed . is_some ( )
492492 }
493493
494494 fn into_completion ( self ) -> Result < Completion > {
@@ -524,17 +524,17 @@ impl SyncHandleSet {
524524 ///
525525 /// Returns an error if there is already a sync intent for this peer in the set.
526526 pub fn insert ( & mut self , peer : NodeId , handle : SyncHandle ) -> Result < ( ) , IntentExistsError > {
527- if self . intents . contains_key ( & peer) {
528- Err ( IntentExistsError ( peer) )
529- } else {
527+ if let std:: collections:: hash_map:: Entry :: Vacant ( e) = self . intents . entry ( peer) {
530528 let SyncHandle {
531529 update_tx,
532530 event_rx,
533531 state,
534532 } = handle;
535533 self . event_rx . insert ( peer, StreamNotifyClose :: new ( event_rx) ) ;
536- self . intents . insert ( peer , HandleState { update_tx, state } ) ;
534+ e . insert ( HandleState { update_tx, state } ) ;
537535 Ok ( ( ) )
536+ } else {
537+ Err ( IntentExistsError ( peer) )
538538 }
539539 }
540540
You can’t perform that action at this time.
0 commit comments