Skip to content

Commit dbf20de

Browse files
committed
more clippy
1 parent 84fbe80 commit dbf20de

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/downloader2/state.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff 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

src/store/traits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub enum BaoBlobSize {
5252
}
5353

5454
impl 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)

0 commit comments

Comments
 (0)