Skip to content

Commit

Permalink
fix: Remove anyhow dep
Browse files Browse the repository at this point in the history
  • Loading branch information
aidan46 committed Jan 31, 2025
1 parent 7f1be01 commit dc1526f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion storage-provider/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ tracing-subscriber = { workspace = true, features = ["env-filter"] }
url = { workspace = true }

[dev-dependencies]
anyhow.workspace = true
libp2p = { workspace = true, features = ["identify", "macros", "noise", "rendezvous", "tcp", "tokio", "yamux"] }

[lints]
Expand Down
11 changes: 5 additions & 6 deletions storage-provider/client/examples/peer-resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
//! ID, the example will return an error.
//! NOTE: This example is to be removed and implemented into the
//! client at some point.
use std::time::Duration;
use std::{time::Duration, error::Error};

use anyhow::{bail, Result};
use clap::Parser;
use libp2p::{
futures::StreamExt,
Expand Down Expand Up @@ -43,7 +42,7 @@ struct Cli {
rendezvous_point: PeerId,
}

fn create_swarm() -> Result<Swarm<Behaviour>> {
fn create_swarm() -> Result<Swarm<Behaviour>, Box<dyn Error>> {
Ok(SwarmBuilder::with_new_identity()
.with_tokio()
.with_tcp(
Expand All @@ -61,7 +60,7 @@ async fn discover(
peer_id_to_find: PeerId,
rendezvous_point_address: Multiaddr,
rendezvous_point: PeerId,
) -> Result<PeerInfo> {
) -> Result<PeerInfo, Box<dyn Error>> {
// Dial in to the rendezvous point.
swarm.dial(rendezvous_point_address)?;

Expand Down Expand Up @@ -94,7 +93,7 @@ async fn discover(
});
}
}
bail!("No registered multi-addresses found for Peer ID {peer_id_to_find}");
return Err(format!("No registered multi-addresses found for Peer ID {peer_id_to_find}").into());
}

other => tracing::debug!("Other event: {other:?}"),
Expand All @@ -103,7 +102,7 @@ async fn discover(
}

#[tokio::main]
async fn main() -> Result<()> {
async fn main() -> Result<(), Box<dyn Error>> {
let _ = tracing_subscriber::fmt()
.with_env_filter(EnvFilter::from_default_env())
.try_init();
Expand Down

0 comments on commit dc1526f

Please sign in to comment.