commit
63d484d50c
@ -18,7 +18,7 @@ std = []
|
||||
unstable = []
|
||||
alloc = ["unstable"]
|
||||
collections = ["alloc"]
|
||||
unstable-testing = ["unstable", "std"]
|
||||
unstable-testing = ["clippy", "unstable", "std"]
|
||||
|
||||
[dependencies]
|
||||
clippy = { version = "^0.*", optional = true }
|
||||
|
@ -128,7 +128,7 @@ impl fmt::Display for Error {
|
||||
write!(formatter, "Unknown variant: {}", variant)
|
||||
}
|
||||
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),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ include = ["Cargo.toml", "build.rs", "src/**/*.rs", "src/lib.rs.in"]
|
||||
[features]
|
||||
default = ["with-syntex"]
|
||||
unstable = ["quasi_macros"]
|
||||
unstable-testing = []
|
||||
unstable-testing = ["clippy"]
|
||||
with-syntex = [
|
||||
"quasi/with-syntex",
|
||||
"quasi_codegen",
|
||||
|
@ -12,7 +12,7 @@ include = ["Cargo.toml", "src/**/*.rs"]
|
||||
|
||||
[features]
|
||||
default = ["with-syntex"]
|
||||
unstable-testing = []
|
||||
unstable-testing = ["clippy"]
|
||||
with-syntex = ["syntex_syntax", "syntex_errors"]
|
||||
|
||||
[dependencies]
|
||||
|
@ -449,12 +449,14 @@ impl Field {
|
||||
}
|
||||
}
|
||||
|
||||
type SerAndDe<T> = (Option<Spanned<T>>, Option<Spanned<T>>);
|
||||
|
||||
fn get_ser_and_de<T, F>(
|
||||
cx: &ExtCtxt,
|
||||
attribute: &'static str,
|
||||
items: &[P<ast::MetaItem>],
|
||||
f: F
|
||||
) -> Result<(Option<Spanned<T>>, Option<Spanned<T>>), ()>
|
||||
) -> Result<SerAndDe<T>, ()>
|
||||
where F: Fn(&ExtCtxt, &str, &ast::Lit) -> Result<T, ()>,
|
||||
{
|
||||
let mut ser_item = Attr::none(cx, attribute);
|
||||
@ -492,21 +494,21 @@ fn get_ser_and_de<T, F>(
|
||||
fn get_renames(
|
||||
cx: &ExtCtxt,
|
||||
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)
|
||||
}
|
||||
|
||||
fn get_where_predicates(
|
||||
cx: &ExtCtxt,
|
||||
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)
|
||||
}
|
||||
|
||||
pub fn get_serde_meta_items(attr: &ast::Attribute) -> Option<&[P<ast::MetaItem>]> {
|
||||
match attr.node.value.node {
|
||||
ast::MetaItemKind::List(ref name, ref items) if name == &"serde" => {
|
||||
attr::mark_used(&attr);
|
||||
attr::mark_used(attr);
|
||||
Some(items)
|
||||
}
|
||||
_ => None
|
||||
@ -570,7 +572,7 @@ fn get_str_from_lit(cx: &ExtCtxt, name: &str, lit: &ast::Lit) -> Result<Interned
|
||||
name,
|
||||
lit_to_string(lit)));
|
||||
|
||||
return Err(());
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ plugin = true
|
||||
|
||||
[features]
|
||||
unstable-testing = [
|
||||
"clippy",
|
||||
"skeptic",
|
||||
"serde_json",
|
||||
"serde/unstable-testing",
|
||||
|
@ -1,5 +1,5 @@
|
||||
#![feature(custom_derive, plugin)]
|
||||
#![plugin(serde_macros)]
|
||||
#![plugin(serde_macros, clippy)]
|
||||
|
||||
#![deny(identity_op)]
|
||||
|
||||
|
@ -12,7 +12,7 @@ keywords = ["serialization"]
|
||||
build = "build.rs"
|
||||
|
||||
[features]
|
||||
unstable-testing = ["serde/unstable-testing", "serde_codegen/unstable-testing"]
|
||||
unstable-testing = ["clippy", "serde/unstable-testing", "serde_codegen/unstable-testing"]
|
||||
|
||||
[build-dependencies]
|
||||
serde_codegen = { path = "../serde_codegen", features = ["with-syntex"] }
|
||||
|
Loading…
Reference in New Issue
Block a user