diff --git a/src/discovery.rs b/src/discovery.rs index e2f9c94..120e77d 100644 --- a/src/discovery.rs +++ b/src/discovery.rs @@ -48,7 +48,7 @@ pub const ANNOUNCE_PARALLELISM: usize = 10; /// * `namespace_id` - The ID of the replica to announce. pub async fn announce_replica(namespace_id: NamespaceId) -> Result<(), Box> { let mut content = BTreeSet::new(); - content.insert(HashAndFormat::raw(Hash::new(namespace_id.clone()))); + content.insert(HashAndFormat::raw(Hash::new(namespace_id))); let dht = mainline::Dht::default(); let announce_stream = announce_dht(dht, content, DISCOVERY_PORT, ANNOUNCE_PARALLELISM); tokio::pin!(announce_stream); diff --git a/src/fs.rs b/src/fs.rs index 0a7822c..fb7d178 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -80,7 +80,7 @@ impl OkuFs { let node = FsNode::persistent(node_path).await?.spawn().await?; let authors = node.authors.list().await?; futures::pin_mut!(authors); - let authors_count = (&authors.as_mut().count().await).to_owned(); + let authors_count = authors.as_mut().count().await.to_owned(); let author_id = if authors_count == 0 { node.authors.create().await? } else { @@ -414,7 +414,7 @@ impl OkuFs { // Some(node_addrs) // } // }; - let content = ContentRequest::Hash(Hash::new(namespace_id.clone())); + let content = ContentRequest::Hash(Hash::new(namespace_id)); let secret_key = self.node.magic_endpoint().secret_key(); let endpoint = MagicEndpoint::builder() .alpns(vec![]) @@ -429,7 +429,7 @@ impl OkuFs { content: content.hash_and_format(), flags: QueryFlags { complete: !partial, - verified: verified, + verified, }, }; println!("content corresponds to infohash {}", to_infohash(q.content)); @@ -503,7 +503,7 @@ pub fn load_or_create_author() -> Result> { let mut rng = OsRng; let author = Author::new(&mut rng); let author_bytes = author.to_bytes(); - std::fs::write(path, &author_bytes)?; + std::fs::write(path, author_bytes)?; Ok(author) } }