Merge pull request #510 from serde-rs/clippy

Re-enable clippy
This commit is contained in:
David Tolnay
2016-08-19 13:01:24 -04:00
committed by GitHub
8 changed files with 14 additions and 11 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ std = []
unstable = [] unstable = []
alloc = ["unstable"] alloc = ["unstable"]
collections = ["alloc"] collections = ["alloc"]
unstable-testing = ["unstable", "std"] unstable-testing = ["clippy", "unstable", "std"]
[dependencies] [dependencies]
clippy = { version = "^0.*", optional = true } clippy = { version = "^0.*", optional = true }
+1 -1
View File
@@ -128,7 +128,7 @@ impl fmt::Display for Error {
write!(formatter, "Unknown variant: {}", variant) write!(formatter, "Unknown variant: {}", variant)
} }
Error::UnknownField(ref field) => write!(formatter, "Unknown field: {}", field), Error::UnknownField(ref field) => write!(formatter, "Unknown field: {}", field),
Error::MissingField(ref field) => write!(formatter, "Missing field: {}", field), Error::MissingField(field) => write!(formatter, "Missing field: {}", field),
} }
} }
} }
+1 -1
View File
@@ -14,7 +14,7 @@ include = ["Cargo.toml", "build.rs", "src/**/*.rs", "src/lib.rs.in"]
[features] [features]
default = ["with-syntex"] default = ["with-syntex"]
unstable = ["quasi_macros"] unstable = ["quasi_macros"]
unstable-testing = [] unstable-testing = ["clippy"]
with-syntex = [ with-syntex = [
"quasi/with-syntex", "quasi/with-syntex",
"quasi_codegen", "quasi_codegen",
+1 -1
View File
@@ -12,7 +12,7 @@ include = ["Cargo.toml", "src/**/*.rs"]
[features] [features]
default = ["with-syntex"] default = ["with-syntex"]
unstable-testing = [] unstable-testing = ["clippy"]
with-syntex = ["syntex_syntax", "syntex_errors"] with-syntex = ["syntex_syntax", "syntex_errors"]
[dependencies] [dependencies]
+7 -5
View File
@@ -449,12 +449,14 @@ impl Field {
} }
} }
type SerAndDe<T> = (Option<Spanned<T>>, Option<Spanned<T>>);
fn get_ser_and_de<T, F>( fn get_ser_and_de<T, F>(
cx: &ExtCtxt, cx: &ExtCtxt,
attribute: &'static str, attribute: &'static str,
items: &[P<ast::MetaItem>], items: &[P<ast::MetaItem>],
f: F f: F
) -> Result<(Option<Spanned<T>>, Option<Spanned<T>>), ()> ) -> Result<SerAndDe<T>, ()>
where F: Fn(&ExtCtxt, &str, &ast::Lit) -> Result<T, ()>, where F: Fn(&ExtCtxt, &str, &ast::Lit) -> Result<T, ()>,
{ {
let mut ser_item = Attr::none(cx, attribute); let mut ser_item = Attr::none(cx, attribute);
@@ -492,21 +494,21 @@ fn get_ser_and_de<T, F>(
fn get_renames( fn get_renames(
cx: &ExtCtxt, cx: &ExtCtxt,
items: &[P<ast::MetaItem>], items: &[P<ast::MetaItem>],
) -> Result<(Option<Spanned<InternedString>>, Option<Spanned<InternedString>>), ()> { ) -> Result<SerAndDe<InternedString>, ()> {
get_ser_and_de(cx, "rename", items, get_str_from_lit) get_ser_and_de(cx, "rename", items, get_str_from_lit)
} }
fn get_where_predicates( fn get_where_predicates(
cx: &ExtCtxt, cx: &ExtCtxt,
items: &[P<ast::MetaItem>], items: &[P<ast::MetaItem>],
) -> Result<(Option<Spanned<Vec<ast::WherePredicate>>>, Option<Spanned<Vec<ast::WherePredicate>>>), ()> { ) -> Result<SerAndDe<Vec<ast::WherePredicate>>, ()> {
get_ser_and_de(cx, "bound", items, parse_lit_into_where) get_ser_and_de(cx, "bound", items, parse_lit_into_where)
} }
pub fn get_serde_meta_items(attr: &ast::Attribute) -> Option<&[P<ast::MetaItem>]> { pub fn get_serde_meta_items(attr: &ast::Attribute) -> Option<&[P<ast::MetaItem>]> {
match attr.node.value.node { match attr.node.value.node {
ast::MetaItemKind::List(ref name, ref items) if name == &"serde" => { ast::MetaItemKind::List(ref name, ref items) if name == &"serde" => {
attr::mark_used(&attr); attr::mark_used(attr);
Some(items) Some(items)
} }
_ => None _ => None
@@ -570,7 +572,7 @@ fn get_str_from_lit(cx: &ExtCtxt, name: &str, lit: &ast::Lit) -> Result<Interned
name, name,
lit_to_string(lit))); lit_to_string(lit)));
return Err(()); Err(())
} }
} }
} }
+1
View File
@@ -17,6 +17,7 @@ plugin = true
[features] [features]
unstable-testing = [ unstable-testing = [
"clippy",
"skeptic", "skeptic",
"serde_json", "serde_json",
"serde/unstable-testing", "serde/unstable-testing",
+1 -1
View File
@@ -1,5 +1,5 @@
#![feature(custom_derive, plugin)] #![feature(custom_derive, plugin)]
#![plugin(serde_macros)] #![plugin(serde_macros, clippy)]
#![deny(identity_op)] #![deny(identity_op)]
+1 -1
View File
@@ -12,7 +12,7 @@ keywords = ["serialization"]
build = "build.rs" build = "build.rs"
[features] [features]
unstable-testing = ["serde/unstable-testing", "serde_codegen/unstable-testing"] unstable-testing = ["clippy", "serde/unstable-testing", "serde_codegen/unstable-testing"]
[build-dependencies] [build-dependencies]
serde_codegen = { path = "../serde_codegen", features = ["with-syntex"] } serde_codegen = { path = "../serde_codegen", features = ["with-syntex"] }