Skip to content

chore: update clippy #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ impl DocCommands {
} => {
let doc = get_doc(docs, env, doc).await?;
let ticket = doc.share(mode, addr_options).await?;
println!("{}", ticket);
println!("{ticket}");
}
Self::Set {
doc,
Expand All @@ -604,7 +604,7 @@ impl DocCommands {
let key = key.as_bytes().to_vec();
let value = value.as_bytes().to_vec();
let hash = doc.set_bytes(author, key, value).await?;
println!("{}", hash);
println!("{hash}");
}
Self::Del {
doc,
Expand Down
10 changes: 5 additions & 5 deletions src/cli/authors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ impl AuthorCommands {
Self::List => {
let mut stream = authors.list().await?;
while let Some(author_id) = stream.try_next().await? {
println!("{}", author_id);
println!("{author_id}");
}
}
Self::Default { switch } => {
if switch && !env.is_console() {
bail!("The --switch flag is only supported within the Iroh console.");
}
let author_id = authors.default().await?;
println!("{}", author_id);
println!("{author_id}");
if switch {
env.set_author(author_id)?;
println!("Active author is now {}", fmt_short(author_id.as_bytes()));
Expand All @@ -68,7 +68,7 @@ impl AuthorCommands {
}

let author_id = authors.create().await?;
println!("{}", author_id);
println!("{author_id}");

if switch {
env.set_author(author_id)?;
Expand All @@ -81,7 +81,7 @@ impl AuthorCommands {
}
Self::Export { author } => match authors.export(author).await? {
Some(author) => {
println!("{}", author);
println!("{author}");
}
None => {
println!("No author found {}", fmt_short(author.as_bytes()));
Expand All @@ -94,7 +94,7 @@ impl AuthorCommands {
println!("Imported {}", fmt_short(id.as_bytes()));
}
Err(err) => {
eprintln!("Invalid author key: {}", err);
eprintln!("Invalid author key: {err}");
}
},
}
Expand Down
8 changes: 4 additions & 4 deletions src/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ impl fmt::Display for NamespaceId {

impl fmt::Debug for NamespaceSecret {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Namespace({})", self)
write!(f, "Namespace({self})")
}
}

Expand All @@ -213,19 +213,19 @@ impl fmt::Debug for AuthorId {

impl fmt::Debug for Author {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Author({})", self)
write!(f, "Author({self})")
}
}

impl fmt::Debug for NamespacePublicKey {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "NamespacePublicKey({})", self)
write!(f, "NamespacePublicKey({self})")
}
}

impl fmt::Debug for AuthorPublicKey {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "AuthorPublicKey({})", self)
write!(f, "AuthorPublicKey({self})")
}
}

Expand Down
19 changes: 5 additions & 14 deletions src/ranger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1203,12 +1203,7 @@ mod tests {
e.key()
);
}
assert_eq!(
expected.len(),
self.alice.len().unwrap(),
"{}: (alice)",
ctx
);
assert_eq!(expected.len(), self.alice.len().unwrap(), "{ctx}: (alice)");
}

fn assert_bob_set(&mut self, ctx: &str, expected: &[(K, V)]) {
Expand All @@ -1218,12 +1213,10 @@ mod tests {
assert_eq!(
self.bob.get(e.key()).unwrap().as_ref(),
Some(e),
"{}: (bob) missing key {:?}",
ctx,
e
"{ctx}: (bob) missing key {e:?}"
);
}
assert_eq!(expected.len(), self.bob.len().unwrap(), "{}: (bob)", ctx);
assert_eq!(expected.len(), self.bob.len().unwrap(), "{ctx}: (bob)");
}
}

Expand Down Expand Up @@ -1360,8 +1353,7 @@ mod tests {
for (e, _) in values {
assert!(
alice_sent.insert(e.key(), e).is_none(),
"alice: duplicate {:?}",
e
"alice: duplicate {e:?}"
);
}
}
Expand All @@ -1375,8 +1367,7 @@ mod tests {
for (e, _) in values {
assert!(
bob_sent.insert(e.key(), e).is_none(),
"bob: duplicate {:?}",
e
"bob: duplicate {e:?}"
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2516,7 +2516,7 @@ mod tests {
while let Some(msg) = next_to_bob.take() {
assert!(rounds < 100, "too many rounds");
rounds += 1;
println!("round {}", rounds);
println!("round {rounds}");
if let Some(msg) = bob.sync_process_message(msg, alice_peer_id, &mut bob_state)? {
next_to_bob = alice.sync_process_message(msg, bob_peer_id, &mut alice_state)?
}
Expand Down
2 changes: 1 addition & 1 deletion tests/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ async fn test_default_author_persist() -> TestResult<()> {
drop(iroh);
let iroh = Node::persistent(iroh_root).spawn().await;
if let Err(cause) = iroh.as_ref() {
panic!("failed to start node: {:?}", cause);
panic!("failed to start node: {cause:?}");
}
iroh?.shutdown().await?;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ async fn redb_doc_import_stress() -> Result<()> {
let mut to_import = Vec::new();
for i in 0..100 {
let data = create_test_data(16 * 1024 * 3 + 1);
let path = temp_path.join(format!("file{}", i));
let path = temp_path.join(format!("file{i}"));
tokio::fs::write(&path, &data).await?;
let key = Bytes::from(format!("{}", path.display()));
to_import.push((key, path, data));
Expand Down
Loading