summaryrefslogtreecommitdiffstats
path: root/ipfs-api
diff options
context:
space:
mode:
authorFerris Tseng <ferristseng@fastmail.fm>2017-12-30 20:07:29 -0500
committerFerris Tseng <ferristseng@fastmail.fm>2017-12-30 20:07:29 -0500
commit06a3776548b8c81226ef61715e5a2e98e29799c9 (patch)
tree2b9ad5ea6b7e82b3fa9eb1bb17305957f2038b9b /ipfs-api
parent59cf5824d43b4df1054bb633a4fe1c3cb8602c42 (diff)
clippy and formatting
Diffstat (limited to 'ipfs-api')
-rw-r--r--ipfs-api/examples/add_tar.rs4
-rw-r--r--ipfs-api/examples/bootstrap_default.rs4
-rw-r--r--ipfs-api/examples/dns.rs2
-rw-r--r--ipfs-api/examples/get_stats.rs4
-rw-r--r--ipfs-api/examples/get_swarm.rs6
-rw-r--r--ipfs-api/examples/mfs.rs12
-rw-r--r--ipfs-api/examples/ping_peer.rs8
-rw-r--r--ipfs-api/examples/pubsub.rs8
-rw-r--r--ipfs-api/src/client.rs21
-rw-r--r--ipfs-api/src/request/object.rs2
-rw-r--r--ipfs-api/src/request/refs.rs2
-rw-r--r--ipfs-api/src/request/swarm.rs2
-rw-r--r--ipfs-api/src/response/files.rs3
13 files changed, 41 insertions, 37 deletions
diff --git a/ipfs-api/examples/add_tar.rs b/ipfs-api/examples/add_tar.rs
index fac6e4c..0a1582c 100644
--- a/ipfs-api/examples/add_tar.rs
+++ b/ipfs-api/examples/add_tar.rs
@@ -44,11 +44,11 @@ fn main() {
let add = core.run(req).expect("expected a valid response");
println!("added tar file: {:?}", add);
- println!("");
+ println!();
let req = client.tar_cat(&add.hash[..]).concat2();
let cat = core.run(req).expect("expected a valid response");
println!("{}", String::from_utf8_lossy(&cat[..]));
- println!("");
+ println!();
}
diff --git a/ipfs-api/examples/bootstrap_default.rs b/ipfs-api/examples/bootstrap_default.rs
index 739167d..d236716 100644
--- a/ipfs-api/examples/bootstrap_default.rs
+++ b/ipfs-api/examples/bootstrap_default.rs
@@ -29,7 +29,7 @@ fn main() {
println!(" {}", peer);
}
- println!("");
+ println!();
println!("dropping all bootstrap peers...");
let drop = client.bootstrap_rm_all();
@@ -40,7 +40,7 @@ fn main() {
println!(" {}", peer);
}
- println!("");
+ println!();
println!("adding default peers...");
let add = client.bootstrap_add_default();
diff --git a/ipfs-api/examples/dns.rs b/ipfs-api/examples/dns.rs
index a4e0450..ec574ab 100644
--- a/ipfs-api/examples/dns.rs
+++ b/ipfs-api/examples/dns.rs
@@ -24,7 +24,7 @@ fn main() {
let dns = core.run(req).expect("dns should resolve");
println!("dns resolves to ({})", &dns.path);
- println!("");
+ println!();
let req = client.file_ls(&dns.path[..]);
let contents = core.run(req).expect("api should return path contents");
diff --git a/ipfs-api/examples/get_stats.rs b/ipfs-api/examples/get_stats.rs
index 3895de6..fe9f84f 100644
--- a/ipfs-api/examples/get_stats.rs
+++ b/ipfs-api/examples/get_stats.rs
@@ -42,13 +42,13 @@ fn main() {
" wantlist: {}",
bitswap_stats.wantlist.join("\n ")
);
- println!("");
+ println!();
println!("bandwidth stats:");
println!(" total in: {}", bw_stats.total_in);
println!(" total out: {}", bw_stats.total_out);
println!(" rate in: {}", bw_stats.rate_in);
println!(" rate out: {}", bw_stats.rate_out);
- println!("");
+ println!();
println!("repo stats:");
println!(" num objs: {}", repo_stats.num_objects);
println!(" repo size: {}", repo_stats.repo_size);
diff --git a/ipfs-api/examples/get_swarm.rs b/ipfs-api/examples/get_swarm.rs
index 207642b..52e547a 100644
--- a/ipfs-api/examples/get_swarm.rs
+++ b/ipfs-api/examples/get_swarm.rs
@@ -24,7 +24,7 @@ fn main() {
let local = client.swarm_addrs_local();
let local = core.run(local).expect("expected a valid response");
- println!("");
+ println!();
println!("your addrs:");
for addr in local.strings {
println!(" {}", addr);
@@ -33,7 +33,7 @@ fn main() {
let connected = client.swarm_peers();
let connected = core.run(connected).expect("expected a valid response");
- println!("");
+ println!();
println!("connected:");
for peer in connected.peers {
let streams: Vec<&str> = peer.streams.iter().map(|s| &s.protocol[..]).collect();
@@ -42,6 +42,6 @@ fn main() {
println!(" latency: {}", peer.latency);
println!(" muxer: {}", peer.muxer);
println!(" streams: {}", streams.join(", "));
- println!("");
+ println!();
}
}
diff --git a/ipfs-api/examples/mfs.rs b/ipfs-api/examples/mfs.rs
index 7c17738..c92e212 100644
--- a/ipfs-api/examples/mfs.rs
+++ b/ipfs-api/examples/mfs.rs
@@ -19,7 +19,7 @@ fn print_stat(stat: response::FilesStatResponse) {
println!(" size : {}", stat.size);
println!(" cum. size: {}", stat.cumulative_size);
println!(" blocks : {}", stat.blocks);
- println!("");
+ println!();
}
// Creates an Ipfs client, and makes some calls to the Mfs Api.
@@ -32,19 +32,19 @@ fn main() {
let client = IpfsClient::default(&core.handle());
println!("making /test...");
- println!("");
+ println!();
let req = client.files_mkdir("/test", false);
core.run(req).expect("expected mkdir to succeed");
println!("making dirs /test/does/not/exist/yet...");
- println!("");
+ println!();
let req = client.files_mkdir("/test/does/not/exist/yet", true);
core.run(req).expect("expected mkdir -p to succeed");
println!("getting status of /test/does...");
- println!("");
+ println!();
let req = client.files_stat("/test/does");
let stat = core.run(req).expect("expected stat to succeed");
@@ -52,7 +52,7 @@ fn main() {
print_stat(stat);
println!("writing source file to /test/mfs.rs");
- println!("");
+ println!();
let src = File::open(file!()).expect("could not read source file");
let req = client.files_write("/test/mfs.rs", true, true, src);
@@ -65,7 +65,7 @@ fn main() {
print_stat(stat);
println!("removing /test...");
- println!("");
+ println!();
let req = client.files_rm("/test", true);
core.run(req).expect("expected rm to succeed");
diff --git a/ipfs-api/examples/ping_peer.rs b/ipfs-api/examples/ping_peer.rs
index 611bd21..36713ee 100644
--- a/ipfs-api/examples/ping_peer.rs
+++ b/ipfs-api/examples/ping_peer.rs
@@ -23,7 +23,7 @@ fn main() {
let mut core = Core::new().expect("expected event loop");
let client = IpfsClient::default(&core.handle());
- println!("");
+ println!();
println!("discovering connected peers...");
let connected = client.swarm_peers();
@@ -33,9 +33,9 @@ fn main() {
"expected at least one peer",
);
- println!("");
+ println!();
println!("discovered peer ({})", peer.peer);
- println!("");
+ println!();
println!("streaming 10 pings...");
let req = client.ping(&peer.peer[..], &Some(10));
@@ -44,7 +44,7 @@ fn main() {
Ok(())
})).expect("expected a valid response");
- println!("");
+ println!();
println!("gathering 15 pings...");
let req = client.ping(&peer.peer[..], &Some(15));
diff --git a/ipfs-api/examples/pubsub.rs b/ipfs-api/examples/pubsub.rs
index 59f8ce7..9d37c04 100644
--- a/ipfs-api/examples/pubsub.rs
+++ b/ipfs-api/examples/pubsub.rs
@@ -41,13 +41,13 @@ fn main() {
.interval(Duration::from_secs(1))
.map_err(|_| response::Error::from("timeout error"))
.for_each(move |_| {
- println!("");
+ println!();
println!("publishing message...");
client.pubsub_pub(TOPIC, "Hello World!")
});
- println!("");
+ println!();
println!("starting task to publish messages to ({})...", TOPIC);
event_loop.run(publish).expect(
"expected the publish task to start",
@@ -62,11 +62,11 @@ fn main() {
let client = get_client(&event_loop.handle());
let req = client.pubsub_sub(TOPIC, false);
- println!("");
+ println!();
println!("waiting for messages on ({})...", TOPIC);
event_loop
.run(req.take(5).for_each(|msg| {
- println!("");
+ println!();
println!("received ({:?})", msg);
Ok(())
diff --git a/ipfs-api/src/client.rs b/ipfs-api/src/client.rs
index dee4a24..4cfcaf1 100644
--- a/ipfs-api/src/client.rs
+++ b/ipfs-api/src/client.rs
@@ -1605,11 +1605,11 @@ impl IpfsClient {
/// Pins a new object.
///
- /// The "recursive" option tells the server whether to
- /// pin just the top-level object, or all sub-objects
+ /// The "recursive" option tells the server whether to
+ /// pin just the top-level object, or all sub-objects
/// it depends on. For most cases you want it to be `true`.
///
- /// Does not yet implement the "progress" agument because
+ /// Does not yet implement the "progress" agument because
/// reading it is kinda squirrelly.
///
/// # Examples
@@ -1628,12 +1628,15 @@ impl IpfsClient {
/// # }
/// ```
#[inline]
- pub fn pin_add(
- &self,
- key: &str,
- recursive: bool
- ) -> AsyncResponse<response::PinAddResponse> {
- self.request(&request::PinAdd { key, recursive: Some(recursive), progress: false }, None)
+ pub fn pin_add(&self, key: &str, recursive: bool) -> AsyncResponse<response::PinAddResponse> {
+ self.request(
+ &request::PinAdd {
+ key,
+ recursive: Some(recursive),
+ progress: false,
+ },
+ None,
+ )
}
/// Returns a list of pinned objects in local storage.
diff --git a/ipfs-api/src/request/object.rs b/ipfs-api/src/request/object.rs
index 3e4da29..c9b3a51 100644
--- a/ipfs-api/src/request/object.rs
+++ b/ipfs-api/src/request/object.rs
@@ -41,7 +41,7 @@ pub struct ObjectLinks<'a> {
}
impl<'a> ApiRequest for ObjectLinks<'a> {
- const PATH: &'static str = "/object/links";
+ const PATH: &'static str = "/object/links";
}
diff --git a/ipfs-api/src/request/refs.rs b/ipfs-api/src/request/refs.rs
index 484869f..1e7c6f4 100644
--- a/ipfs-api/src/request/refs.rs
+++ b/ipfs-api/src/request/refs.rs
@@ -14,5 +14,5 @@ pub struct RefsLocal;
impl_skip_serialize!(RefsLocal);
impl ApiRequest for RefsLocal {
- const PATH: &'static str = "/refs/local";
+ const PATH: &'static str = "/refs/local";
}
diff --git a/ipfs-api/src/request/swarm.rs b/ipfs-api/src/request/swarm.rs
index 3953fdb..c9a8da7 100644
--- a/ipfs-api/src/request/swarm.rs
+++ b/ipfs-api/src/request/swarm.rs
@@ -23,5 +23,5 @@ pub struct SwarmPeers;
impl_skip_serialize!(SwarmPeers);
impl ApiRequest for SwarmPeers {
- const PATH: &'static str = "/swarm/peers";
+ const PATH: &'static str = "/swarm/peers";
}
diff --git a/ipfs-api/src/response/files.rs b/ipfs-api/src/response/files.rs
index 1b073de..ae0c7d8 100644
--- a/ipfs-api/src/response/files.rs
+++ b/ipfs-api/src/response/files.rs
@@ -20,7 +20,8 @@ pub type FilesFlushResponse = ();
pub struct FilesEntry {
pub name: String,
- // This is a protocol buffer enum type defined in https://github.com/ipfs/go-ipfs/blob/master/unixfs/pb/unixfs.proto ...
+ // This is a protocol buffer enum type defined in
+ // https://github.com/ipfs/go-ipfs/blob/master/unixfs/pb/unixfs.proto ...
// So it might be some other type than u64, but certainly shouldn't be *bigger* than u64.
#[serde(rename = "Type")]
pub typ: u64,