Skip to content

Commit 1905089

Browse files
committed
fmt & clippy
1 parent 419f8d8 commit 1905089

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

examples/multiprovider/downloader2.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ use std::{
1717
io,
1818
marker::PhantomData,
1919
sync::Arc,
20-
time::Instant,
21-
u64,
20+
time::{Duration, Instant},
2221
};
2322

23+
use anyhow::Context;
24+
use bao_tree::{io::BaoContentItem, ChunkNum, ChunkRanges};
25+
use futures_lite::StreamExt;
26+
use futures_util::{stream::BoxStream, FutureExt};
27+
use iroh::{Endpoint, NodeId};
2428
use iroh_blobs::{
2529
get::{
2630
fsm::{BlobContentNext, ConnectedNext, EndBlobNext},
@@ -31,14 +35,8 @@ use iroh_blobs::{
3135
util::local_pool::{self, LocalPool, LocalPoolHandle},
3236
Hash,
3337
};
34-
use anyhow::Context;
35-
use bao_tree::{io::BaoContentItem, ChunkNum, ChunkRanges};
36-
use futures_lite::StreamExt;
37-
use futures_util::{stream::BoxStream, FutureExt};
38-
use iroh::{Endpoint, NodeId};
3938
use range_collections::range_set::RangeSetRange;
4039
use serde::{Deserialize, Serialize};
41-
use std::time::Duration;
4240
use tokio::sync::mpsc;
4341
use tokio_util::task::AbortOnDropHandle;
4442
use tracing::{debug, error, info, trace};
@@ -259,6 +257,7 @@ pub struct DownloaderBuilder<S> {
259257
planner: Option<BoxedDownloadPlanner>,
260258
}
261259

260+
#[allow(dead_code)]
262261
impl<S> DownloaderBuilder<S> {
263262
/// Set the content discovery
264263
pub fn discovery<D: ContentDiscovery>(self, discovery: D) -> Self {
@@ -506,11 +505,10 @@ impl<S: Store> BitfieldSubscription for SimpleBitfieldSubscription<S> {
506505
}
507506
Box::pin(
508507
async move {
509-
let event = match recv.await {
508+
match recv.await {
510509
Ok(ev) => ev,
511510
Err(_) => BitfieldState::unknown().into(),
512-
};
513-
event
511+
}
514512
}
515513
.into_stream(),
516514
)
@@ -591,13 +589,13 @@ mod tests {
591589
#![allow(clippy::single_range_in_vec_init)]
592590
use std::ops::Range;
593591

594-
use crate::{net_protocol::Blobs, store::MapMut};
595-
596-
use super::*;
597592
use bao_tree::ChunkNum;
598593
use iroh::{protocol::Router, SecretKey};
599594
use testresult::TestResult;
600595

596+
use super::*;
597+
use crate::{net_protocol::Blobs, store::MapMut};
598+
601599
fn print_bitfield(iter: impl IntoIterator<Item = bool>) -> String {
602600
let mut chars = String::new();
603601
for x in iter {

examples/multiprovider/downloader2/content_discovery.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
use std::collections::BTreeMap;
22

3-
use crate::Hash;
43
use futures_lite::stream::StreamExt;
54
use futures_util::stream::BoxStream;
65
use iroh::NodeId;
76
use serde::{Deserialize, Serialize};
87

8+
use crate::Hash;
9+
910
/// Announce kind
1011
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Default)]
1112
pub enum AnnounceKind {
@@ -20,6 +21,7 @@ pub enum AnnounceKind {
2021
#[derive(Debug, Default)]
2122
pub struct FindPeersOpts {
2223
/// Kind of announce
24+
#[allow(dead_code)]
2325
pub kind: AnnounceKind,
2426
}
2527

examples/multiprovider/downloader2/state.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -931,12 +931,15 @@ fn total_chunks(chunks: &ChunkRanges) -> Option<u64> {
931931
mod tests {
932932
#![allow(clippy::single_range_in_vec_init)]
933933

934-
use super::super::tests::{
935-
chunk_ranges, has_all_events, has_one_event, has_one_event_matching, noop_planner,
936-
};
937-
use super::*;
938934
use testresult::TestResult;
939935

936+
use super::{
937+
super::tests::{
938+
chunk_ranges, has_all_events, has_one_event, has_one_event_matching, noop_planner,
939+
},
940+
*,
941+
};
942+
940943
/// Test a simple scenario where a download is started and completed
941944
#[test]
942945
fn downloader_state_smoke() -> TestResult<()> {

examples/multiprovider/main.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ use downloader2::{
99
print_bitmap, BitfieldEvent, BitfieldState, BitfieldUpdate, DownloadRequest, Downloader,
1010
ObserveRequest, StaticContentDiscovery,
1111
};
12-
use iroh_blobs::{
13-
store::Store,
14-
Hash,
15-
};
12+
use iroh_blobs::{store::Store, Hash};
1613

1714
#[derive(Debug, Parser)]
1815
struct Args {

0 commit comments

Comments
 (0)