From 74245c7a9500be16d47a71753170bcc183c067db Mon Sep 17 00:00:00 2001 From: Sameer Puri <11097096+sameer@users.noreply.github.com> Date: Mon, 31 Dec 2018 16:37:03 -0500 Subject: Fix clippy warnings --- ipfs-api/src/client.rs | 6 +++--- ipfs-api/src/read.rs | 4 ++-- ipfs-api/src/request/key.rs | 4 ++-- ipfs-api/src/request/log.rs | 14 +++++++------- ipfs-api/src/request/object.rs | 2 +- ipfs-api/src/response/serde.rs | 8 ++++---- 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 { 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(self, num: i32) -> Result where E: Error, { - Ok(num as i64) + Ok(num.into()) } fn visit_i64(self, num: i64) -> Result @@ -46,14 +46,14 @@ impl<'de> Visitor<'de> for IntegerVisitor { where E: Error, { - Ok(num as i64) + Ok(num.into()) } fn visit_u32(self, num: u32) -> Result where E: Error, { - Ok(num as i64) + Ok(num.into()) } fn visit_u64(self, num: u64) -> Result -- cgit v1.2.3