File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -262,11 +262,11 @@ impl DownloaderState {
262262 PeerBlobState :: new ( subscription_id) ,
263263 ) ;
264264 }
265- if ! self . discovery . contains_key ( & request. hash ) {
265+ if let std :: collections :: btree_map :: Entry :: Vacant ( e ) = self . discovery . entry ( request. hash ) {
266266 // start a discovery task
267267 let id = self . discovery_id_gen . next ( ) ;
268268 evs. push ( Event :: StartDiscovery { hash, id } ) ;
269- self . discovery . insert ( request . hash , id) ;
269+ e . insert ( id) ;
270270 }
271271 self . downloads . insert ( id, DownloadState :: new ( request) ) ;
272272 self . check_completion ( hash, Some ( id) , evs) ?;
@@ -825,9 +825,7 @@ impl Downloads {
825825 id : PeerDownloadId ,
826826 ) -> Option < ( & DownloadId , & mut DownloadState ) > {
827827 self . by_id
828- . iter_mut ( )
829- . filter ( |( _, v) | v. peer_downloads . iter ( ) . any ( |( _, state) | state. id == id) )
830- . next ( )
828+ . iter_mut ( ) . find ( |( _, v) | v. peer_downloads . iter ( ) . any ( |( _, state) | state. id == id) )
831829 }
832830}
833831
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ pub enum BaoBlobSize {
5252}
5353
5454impl BaoBlobSize {
55- /// Create a new `BaoFileSize ` with the given size and verification status.
55+ /// Create a new `BaoBlobSize ` with the given size and verification status.
5656 pub fn new ( size : u64 , verified : bool ) -> Self {
5757 if verified {
5858 BaoBlobSize :: Verified ( size)
You can’t perform that action at this time.
0 commit comments