Clippy
This commit is contained in:
parent
62d5288398
commit
3e6c2eae79
5 changed files with 36 additions and 24 deletions
|
|
@ -1253,10 +1253,7 @@ impl PeerHandler {
|
|||
///
|
||||
/// If this returns, an existing in-flight piece was marked to be ours.
|
||||
fn try_steal_old_slow_piece(&self, threshold: f64) -> Option<ValidPieceIndex> {
|
||||
let my_avg_time = match self.counters.average_piece_download_time() {
|
||||
Some(t) => t,
|
||||
None => return None,
|
||||
};
|
||||
let my_avg_time = self.counters.average_piece_download_time()?;
|
||||
|
||||
let (stolen_idx, from_peer) = {
|
||||
let mut g = self.state.lock_write("try_steal_old_slow_piece");
|
||||
|
|
|
|||
|
|
@ -263,8 +263,6 @@ impl LivePeerState {
|
|||
}
|
||||
|
||||
pub fn has_full_torrent(&self, total_pieces: usize) -> bool {
|
||||
self.bitfield
|
||||
.get(0..total_pieces)
|
||||
.map_or(false, |s| s.all())
|
||||
self.bitfield.get(0..total_pieces).is_some_and(|s| s.all())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue