parent
ae6ce1e51d
commit
82de2d267f
@ -0,0 +1,74 @@
|
|||||||
|
From c32fcc0fe29a952829757b7936b222f390d39d38 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Josh Stone <jistone@redhat.com>
|
||||||
|
Date: Thu, 8 Mar 2018 20:34:22 -0800
|
||||||
|
Subject: [PATCH] Update to syn 0.12
|
||||||
|
|
||||||
|
---
|
||||||
|
Cargo.toml | 2 +-
|
||||||
|
src/lib.rs | 28 +++++++++++++++-------------
|
||||||
|
2 files changed, 16 insertions(+), 14 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/lib.rs b/src/lib.rs
|
||||||
|
index 09d41e58eae4..4e98771e8627 100644
|
||||||
|
--- a/src/lib.rs
|
||||||
|
+++ b/src/lib.rs
|
||||||
|
@@ -398,17 +398,19 @@ pub fn check_html_root_url(path: &str, pkg_name: &str, pkg_version: &str) -> Res
|
||||||
|
.map_err(|err| format!("could not read {}: {}", path, err))?;
|
||||||
|
let version = parse_version(pkg_version)
|
||||||
|
.map_err(|err| format!("bad package version {:?}: {}", pkg_version, err))?;
|
||||||
|
- let krate = syn::parse_crate(&code)
|
||||||
|
+ let krate: syn::File = syn::parse_str(&code)
|
||||||
|
.map_err(|_| format!("could not parse {}: please run \"cargo build\"", path))?;
|
||||||
|
|
||||||
|
println!("Checking doc attributes in {}...", path);
|
||||||
|
for attr in krate.attrs {
|
||||||
|
- let (ident, nested_meta_items) = match attr {
|
||||||
|
- syn::Attribute {
|
||||||
|
- style: syn::AttrStyle::Inner,
|
||||||
|
- value: syn::MetaItem::List(ref ident, ref nested_meta_items),
|
||||||
|
- is_sugared_doc: false,
|
||||||
|
- } => (ident, nested_meta_items),
|
||||||
|
+ if let syn::AttrStyle::Outer = attr.style {
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ if attr.is_sugared_doc {
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ let (ident, nested_meta_items) = match attr.interpret_meta() {
|
||||||
|
+ Some(syn::Meta::List(syn::MetaList { ident, nested, .. })) => (ident, nested),
|
||||||
|
_ => continue,
|
||||||
|
};
|
||||||
|
|
||||||
|
@@ -417,23 +419,23 @@ pub fn check_html_root_url(path: &str, pkg_name: &str, pkg_version: &str) -> Res
|
||||||
|
}
|
||||||
|
|
||||||
|
for nested_meta_item in nested_meta_items {
|
||||||
|
- let meta_item = match *nested_meta_item {
|
||||||
|
- syn::NestedMetaItem::MetaItem(ref meta_item) => meta_item,
|
||||||
|
+ let meta_item = match nested_meta_item {
|
||||||
|
+ syn::NestedMeta::Meta(ref meta_item) => meta_item,
|
||||||
|
_ => continue,
|
||||||
|
};
|
||||||
|
|
||||||
|
let check_result = match *meta_item {
|
||||||
|
- syn::MetaItem::NameValue(ref name, ref value) if name == "html_root_url" => {
|
||||||
|
- match *value {
|
||||||
|
+ syn::Meta::NameValue(syn::MetaNameValue { ref ident, ref lit, .. }) if ident == "html_root_url" => {
|
||||||
|
+ match *lit {
|
||||||
|
// Accept both cooked and raw strings here.
|
||||||
|
- syn::Lit::Str(ref s, _) => url_matches(s, pkg_name, &version),
|
||||||
|
+ syn::Lit::Str(ref s) => url_matches(&s.value(), pkg_name, &version),
|
||||||
|
// A non-string html_root_url is probably an
|
||||||
|
// error, but we leave this check to the
|
||||||
|
// compiler.
|
||||||
|
_ => continue,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- syn::MetaItem::Word(ref name) if name == "html_root_url" => {
|
||||||
|
+ syn::Meta::Word(ref name) if name == "html_root_url" => {
|
||||||
|
Err(String::from("html_root_url attribute without URL"))
|
||||||
|
}
|
||||||
|
_ => continue,
|
||||||
|
--
|
||||||
|
2.14.3
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
--- version-sync-0.5.0/Cargo.toml 1969-12-31T16:00:00-08:00
|
||||||
|
+++ version-sync-0.5.0/Cargo.toml 2018-03-08T20:49:53.515269-08:00
|
||||||
|
@@ -33,7 +33,7 @@
|
||||||
|
version = "0.7"
|
||||||
|
|
||||||
|
[dependencies.syn]
|
||||||
|
-version = "0.11"
|
||||||
|
+version = "0.12"
|
||||||
|
features = ["full"]
|
||||||
|
|
||||||
|
[dependencies.toml]
|
Loading…
Reference in new issue