Skip to content

Commit

Permalink
refactor: happy clippy (#2220)
Browse files Browse the repository at this point in the history
new beta clippy has more to fix :)
  • Loading branch information
dignifiedquire authored Apr 22, 2024
1 parent 93290e3 commit d6ff0cf
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 21 deletions.
2 changes: 1 addition & 1 deletion iroh-bytes/src/downloader/invariants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl<G: Getter<Connection = D::Connection>, D: Dialer, S: Store> Service<G, D, S
"all queued requests have providers"
);
assert!(
self.requests.get(entry).is_some(),
self.requests.contains_key(entry),
"all queued requests have request info"
);
}
Expand Down
2 changes: 1 addition & 1 deletion iroh-bytes/src/util/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ use iroh_io::AsyncSliceWriter;
///
/// A typical implementation will wrap the sender part of a channel and an id generator.
pub trait ProgressSender: std::fmt::Debug + Clone + Send + Sync + 'static {
///
/// The message being sent.
type Msg: Send + Sync + 'static;

/// Send a message and wait if the receiver is full.
Expand Down
2 changes: 1 addition & 1 deletion iroh-net/src/netcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ impl Actor {
fn add_report_history_and_set_preferred_relay(&mut self, mut r: Report) -> Arc<Report> {
let mut prev_relay = None;
if let Some(ref last) = self.reports.last {
prev_relay = last.preferred_relay.clone();
prev_relay.clone_from(&last.preferred_relay);
}
let now = Instant::now();
const MAX_AGE: Duration = Duration::from_secs(5 * 60);
Expand Down
2 changes: 1 addition & 1 deletion iroh-net/src/relay/clients.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ mod tests {

clients.unregister(&a_key.clone());

assert!(clients.inner.get(&a_key).is_none());
assert!(!clients.inner.contains_key(&a_key));

clients.shutdown().await;
Ok(())
Expand Down
16 changes: 1 addition & 15 deletions iroh-sync/src/store/fs/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::time::Instant;
use bytes::Bytes;
use redb::{
MultimapTable, MultimapTableDefinition, ReadOnlyMultimapTable, ReadOnlyTable, ReadTransaction,
ReadableTable, Table, TableDefinition, WriteTransaction,
Table, TableDefinition, WriteTransaction,
};

use crate::PeerIdBytes;
Expand Down Expand Up @@ -73,20 +73,6 @@ pub type Nanos = u64;
pub const DOWNLOAD_POLICY_TABLE: TableDefinition<&[u8; 32], &[u8]> =
TableDefinition::new("download-policy-1");

pub trait ReadableTables {
fn records(&self) -> impl ReadableTable<RecordsId<'static>, RecordsValue<'static>>;
fn records_by_key(&self) -> impl ReadableTable<RecordsByKeyId<'static>, ()>;
fn namespaces(&self) -> impl ReadableTable<&'static [u8; 32], (u8, &'static [u8; 32])>;
fn latest_per_author(
&self,
) -> impl ReadableTable<LatestPerAuthorKey<'static>, LatestPerAuthorValue<'static>>;
// fn namespace_peers(
// &self,
// ) -> impl ReadableMultimapTable<&'static [u8; 32], (Nanos, &'static PeerIdBytes)>;
fn download_policy(&self) -> impl ReadableTable<&'static [u8; 32], &'static [u8]>;
fn authors(&self) -> impl ReadableTable<&'static [u8; 32], &'static [u8; 32]>;
}

self_cell::self_cell! {
struct TransactionAndTablesInner {
owner: WriteTransaction,
Expand Down
2 changes: 1 addition & 1 deletion iroh/src/node/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use crate::{

use super::{rpc, Callbacks, EventCallback, Node, RpcStatus};

pub const PROTOCOLS: [&[u8]; 3] = [&iroh_bytes::protocol::ALPN, GOSSIP_ALPN, SYNC_ALPN];
pub const PROTOCOLS: [&[u8]; 3] = [iroh_bytes::protocol::ALPN, GOSSIP_ALPN, SYNC_ALPN];

/// Default bind address for the node.
/// 11204 is "iroh" in leetspeak <https://simple.wikipedia.org/wiki/Leet>
Expand Down
1 change: 0 additions & 1 deletion iroh/tests/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,6 @@ mod file {
Ok(())
}

///
#[tokio::test]
async fn gc_file_stress() -> Result<()> {
let _ = tracing_subscriber::fmt::try_init();
Expand Down

0 comments on commit d6ff0cf

Please sign in to comment.