summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSameer Puri <11097096+sameer@users.noreply.github.com>2018-12-31 16:37:03 -0500
committerSameer Puri <11097096+sameer@users.noreply.github.com>2018-12-31 16:37:03 -0500
commit74245c7a9500be16d47a71753170bcc183c067db (patch)
tree97b46d413a57b841793b33e58d0f82d3d44aa717
parent2704d2b28996808fe4d20138034e1af81ddc8b0e (diff)
Fix clippy warnings
-rw-r--r--ipfs-api/src/client.rs6
-rw-r--r--ipfs-api/src/read.rs4
-rw-r--r--ipfs-api/src/request/key.rs4
-rw-r--r--ipfs-api/src/request/log.rs14
-rw-r--r--ipfs-api/src/request/object.rs2
-rw-r--r--ipfs-api/src/response/serde.rs8
6 files changed, 19 insertions, 19 deletions
diff --git a/ipfs-api/src/client.rs b/ipfs-api/src/client.rs
index 2613541..e7f7d5b 100644
--- a/ipfs-api/src/client.rs
+++ b/ipfs-api/src/client.rs
@@ -107,9 +107,9 @@ impl IpfsClient {
#[inline]
fn build_error_from_body(chunk: Chunk) -> Error {
match serde_json::from_slice(&chunk) {
- Ok(e) => Error::Api(e).into(),
+ Ok(e) => Error::Api(e),
Err(_) => match String::from_utf8(chunk.to_vec()) {
- Ok(s) => Error::Uncategorized(s).into(),
+ Ok(s) => Error::Uncategorized(s),
Err(e) => e.into(),
},
}
@@ -310,7 +310,7 @@ impl IpfsClient {
// There was an unrecognized trailer value. If that is the case,
// create a stream that immediately errors.
//
- return Box::new(stream::once(Err(err.into())));
+ return Box::new(stream::once(Err(err)));
}
} else {
false
diff --git a/ipfs-api/src/read.rs b/ipfs-api/src/read.rs
index 674d5fa..b12c8b2 100644
--- a/ipfs-api/src/read.rs
+++ b/ipfs-api/src/read.rs
@@ -75,7 +75,7 @@ where
String::from_utf8_lossy(&slice[colon + 2..]).into(),
);
- Err(e.into())
+ Err(e)
}
_ => Err(e.into()),
}
@@ -143,7 +143,7 @@ where
#[inline]
pub fn new(stream: S) -> StreamReader<S> {
StreamReader {
- stream: stream,
+ stream,
state: ReadState::NotReady,
}
}
diff --git a/ipfs-api/src/request/key.rs b/ipfs-api/src/request/key.rs
index d2e81f8..5f723eb 100644
--- a/ipfs-api/src/request/key.rs
+++ b/ipfs-api/src/request/key.rs
@@ -21,8 +21,8 @@ impl Serialize for KeyType {
S: Serializer,
{
let s = match self {
- &KeyType::Rsa => "rsa",
- &KeyType::Ed25519 => "ed25519",
+ KeyType::Rsa => "rsa",
+ KeyType::Ed25519 => "ed25519",
};
serializer.serialize_str(s)
diff --git a/ipfs-api/src/request/log.rs b/ipfs-api/src/request/log.rs
index 6f9ca49..5942b0f 100644
--- a/ipfs-api/src/request/log.rs
+++ b/ipfs-api/src/request/log.rs
@@ -25,11 +25,11 @@ impl Serialize for LoggingLevel {
S: Serializer,
{
let s = match self {
- &LoggingLevel::Debug => "debug",
- &LoggingLevel::Info => "info",
- &LoggingLevel::Warning => "warning",
- &LoggingLevel::Error => "error",
- &LoggingLevel::Critical => "critical",
+ LoggingLevel::Debug => "debug",
+ LoggingLevel::Info => "info",
+ LoggingLevel::Warning => "warning",
+ LoggingLevel::Error => "error",
+ LoggingLevel::Critical => "critical",
};
serializer.serialize_str(s)
@@ -47,8 +47,8 @@ impl<'a> Serialize for Logger<'a> {
S: Serializer,
{
let s = match self {
- &Logger::All => "*",
- &Logger::Specific(ref logger) => logger.as_ref(),
+ Logger::All => "*",
+ Logger::Specific(ref logger) => logger.as_ref(),
};
serializer.serialize_str(s)
diff --git a/ipfs-api/src/request/object.rs b/ipfs-api/src/request/object.rs
index f28bfa5..f93f0a0 100644
--- a/ipfs-api/src/request/object.rs
+++ b/ipfs-api/src/request/object.rs
@@ -63,7 +63,7 @@ impl Serialize for ObjectTemplate {
S: Serializer,
{
let s = match self {
- &ObjectTemplate::UnixFsDir => "unixfs-dir",
+ ObjectTemplate::UnixFsDir => "unixfs-dir",
};
serializer.serialize_str(s)
diff --git a/ipfs-api/src/response/serde.rs b/ipfs-api/src/response/serde.rs
index 8cfd818..4e7b070 100644
--- a/ipfs-api/src/response/serde.rs
+++ b/ipfs-api/src/response/serde.rs
@@ -25,14 +25,14 @@ impl<'de> Visitor<'de> for IntegerVisitor {
where
E: Error,
{
- Ok(num as i64)
+ Ok(num.into())
}
fn visit_i32<E>(self, num: i32) -> Result<Self::Value, E>
where
E: Error,
{
- Ok(num as i64)
+ Ok(num.into())
}
fn visit_i64<E>(self, num: i64) -> Result<Self::Value, E>
@@ -46,14 +46,14 @@ impl<'de> Visitor<'de> for IntegerVisitor {
where
E: Error,
{
- Ok(num as i64)
+ Ok(num.into())
}
fn visit_u32<E>(self, num: u32) -> Result<Self::Value, E>
where
E: Error,
{
- Ok(num as i64)
+ Ok(num.into())
}
fn visit_u64<E>(self, num: u64) -> Result<Self::Value, E>