feat(clippy): Use clippy for it's extra lints

This commit is contained in:
Erick Tryzelaar
2016-01-18 12:24:03 -08:00
parent fbcf905c9f
commit bfa2b69193
19 changed files with 57 additions and 34 deletions
+6 -5
View File
@@ -9,12 +9,13 @@ documentation = "https://serde-rs.github.io/serde/serde/serde/index.html"
readme = "../README.md"
keywords = ["serde", "serialization"]
[dependencies]
num = "^0.1.27"
[features]
nightly = []
num-impls = ["num-bigint", "num-complex", "num-rational"]
nightly = ["clippy"]
num-bigint = ["num/bigint"]
num-complex = ["num/complex"]
num-impls = ["num-bigint", "num-complex", "num-rational"]
num-rational = ["num/rational"]
[dependencies]
clippy = { version = "^0.0.35", optional = true }
num = { version = "^0.1.27", default-features = false }
+3 -3
View File
@@ -234,7 +234,7 @@ impl Visitor for StringVisitor {
fn visit_str<E>(&mut self, v: &str) -> Result<String, E>
where E: Error,
{
Ok(v.to_string())
Ok(v.to_owned())
}
fn visit_string<E>(&mut self, v: String) -> Result<String, E>
@@ -247,12 +247,12 @@ impl Visitor for StringVisitor {
where E: Error,
{
match str::from_utf8(v) {
Ok(s) => Ok(s.to_string()),
Ok(s) => Ok(s.to_owned()),
Err(_) => Err(Error::type_mismatch(Type::String)),
}
}
fn visit_byte_buf<'a, E>(&mut self, v: Vec<u8>) -> Result<String, E>
fn visit_byte_buf<E>(&mut self, v: Vec<u8>) -> Result<String, E>
where E: Error,
{
match String::from_utf8(v) {
+4 -1
View File
@@ -10,7 +10,10 @@
//! [github repository](https://github.com/serde-rs/serde)
#![doc(html_root_url="https://serde-rs.github.io/serde/serde")]
#![cfg_attr(feature = "nightly", feature(collections, enumset, nonzero, step_trait, zero_one))]
#![cfg_attr(feature = "nightly", feature(collections, enumset, nonzero, plugin, step_trait,
zero_one))]
#![cfg_attr(feature = "nightly", plugin(clippy))]
#![cfg_attr(feature = "nightly", allow(linkedlist))]
#![deny(missing_docs)]
+2 -2
View File
@@ -566,8 +566,8 @@ impl<K, V, I> MapVisitor for MapIteratorVisitor<I>
{
match self.iter.next() {
Some((key, value)) => {
let value = try!(serializer.visit_map_elt(key, value));
Ok(Some(value))
try!(serializer.visit_map_elt(key, value));
Ok(Some(()))
}
None => Ok(None)
}
+2
View File
@@ -322,6 +322,7 @@ pub trait Serializer {
}
/// A trait that is used by a `Serialize` to iterate through a sequence.
#[cfg_attr(feature = "nightly", allow(len_without_is_empty))]
pub trait SeqVisitor {
/// Serializes a sequence item in the serializer.
///
@@ -338,6 +339,7 @@ pub trait SeqVisitor {
}
/// A trait that is used by a `Serialize` to iterate through a map.
#[cfg_attr(feature = "nightly", allow(len_without_is_empty))]
pub trait MapVisitor {
/// Serializes a map item in the serializer.
///