Codebase list rust-stfu8 / a50b8af
Update strum-macros kpcyrd 3 years ago
6 changed file(s) with 21 addition(s) and 184 deletion(s). Raw diff Collapse all Expand all
0 rust-strum-macros (0.18.0-1) UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; urgency=medium
1
2 * Package strum_macros 0.18.0 from crates.io using debcargo 2.4.2
3
4 -- kpcyrd <git@rxv.cc> Fri, 01 May 2020 15:31:29 +0200
5
06 rust-strum-macros (0.15.0-3) unstable; urgency=medium
17
28 * Apply patch for syn/quote/proc-macro2 1.0
00 Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
11 Upstream-Name: strum_macros
2 Upstream-Contact: Peter Glotfelty <peglotfe@microsoft.com>
2 Upstream-Contact: Peter Glotfelty <peter.glotfelty@microsoft.com>
33
44 Files: *
5 Copyright: 2017-2019 Peter Glotfelty <peglotfe@microsoft.com>
5 Copyright: 2017-2020 Peter Glotfelty <peter.glotfelty@microsoft.com>
66 License: MIT
77
88 Files: debian/*
99 Copyright:
10 2019 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
11 2019 kpcyrd <git@rxv.cc>
10 2019-2020 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
11 2019-2020 kpcyrd <git@rxv.cc>
1212 License: MIT
1313
1414 License: MIT
00 Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
11 Upstream-Name: strum_macros
2 Upstream-Contact: Peter Glotfelty <peglotfe@microsoft.com>
2 Upstream-Contact: Peter Glotfelty <peter.glotfelty@microsoft.com>
33
44 Files: *
5 Copyright: FIXME (overlay) UNKNOWN-YEARS Peter Glotfelty <peglotfe@microsoft.com>
5 Copyright: FIXME (overlay) UNKNOWN-YEARS Peter Glotfelty <peter.glotfelty@microsoft.com>
66 License: MIT
77 Comment:
88 FIXME (overlay): Since upstream copyright years are not available in
1010 be correct information so you should review and fix this before uploading to
1111 the archive.
1212
13 Files: ./LICENSE
14 Copyright: 2019 Peter Glotfelty
15 License: UNKNOWN-LICENSE; FIXME (overlay)
16 Comment:
17 FIXME (overlay): These notices are extracted from files. Please review them
18 before uploading to the archive.
19
1320 Files: debian/*
1421 Copyright:
15 2019 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
16 2019 kpcyrd <git@rxv.cc>
22 2019-2020 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
23 2019-2020 kpcyrd <git@rxv.cc>
1724 License: MIT
1825
1926 License: MIT
+0
-19
src/strum-macros/debian/patches/relax-deps.patch less more
0 --- a/Cargo.toml
1 +++ b/Cargo.toml
2 @@ -29,13 +29,13 @@
3 version = "0.3"
4
5 [dependencies.proc-macro2]
6 -version = "0.4"
7 +version = "1.0"
8
9 [dependencies.quote]
10 -version = "0.6"
11 +version = "1.0"
12
13 [dependencies.syn]
14 -version = "0.15"
15 +version = "1.0"
16 features = ["parsing", "extra-traits"]
17
18 [features]
+0
-2
src/strum-macros/debian/patches/series less more
0 relax-deps.patch
1 syn-quote-proc-macro2.patch
+0
-155
src/strum-macros/debian/patches/syn-quote-proc-macro2.patch less more
0 --- a/src/enum_discriminants.rs
1 +++ b/src/enum_discriminants.rs
2 @@ -2,7 +2,8 @@
3 use syn;
4
5 use helpers::{
6 - extract_list_metas, extract_meta, filter_metas, get_meta_ident, get_meta_list, unique_meta_list,
7 + eq_path_str, extract_list_metas, extract_meta, filter_metas, get_meta_ident, get_meta_list,
8 + unique_meta_list,
9 };
10
11 pub fn enum_discriminants_inner(ast: &syn::DeriveInput) -> TokenStream {
12 @@ -43,7 +44,9 @@
13 // Pass through all other attributes
14 let pass_though_attributes =
15 filter_metas(discriminant_attrs.iter().map(|&m| m), |meta| match meta {
16 - syn::Meta::List(ref metalist) => metalist.ident != "derive" && metalist.ident != "name",
17 + syn::Meta::List(ref metalist) => {
18 + !eq_path_str(&metalist.path, "derive") && !eq_path_str(&metalist.path, "name")
19 + }
20 _ => true,
21 })
22 .map(|meta| quote! { #[ #meta ] })
23 @@ -56,8 +59,8 @@
24
25 // Don't copy across the "strum" meta attribute.
26 let attrs = variant.attrs.iter().filter(|attr| {
27 - attr.interpret_meta().map_or(true, |meta| match meta {
28 - syn::Meta::List(ref metalist) => metalist.ident != "strum",
29 + attr.parse_meta().ok().map_or(true, |meta| match meta {
30 + syn::Meta::List(ref metalist) => !eq_path_str(&metalist.path, "strum"),
31 _ => true,
32 })
33 });
34 --- a/src/enum_properties.rs
35 +++ b/src/enum_properties.rs
36 @@ -2,18 +2,18 @@
37 use syn;
38 use syn::Meta;
39
40 -use helpers::{extract_meta, is_disabled};
41 +use helpers::{eq_path_str, extract_meta, is_disabled};
42
43 fn extract_properties(meta: &[Meta]) -> Vec<(&syn::Ident, &syn::Lit)> {
44 use syn::{MetaList, MetaNameValue, NestedMeta};
45 meta.iter()
46 .filter_map(|meta| match *meta {
47 Meta::List(MetaList {
48 - ref ident,
49 + ref path,
50 ref nested,
51 ..
52 }) => {
53 - if ident == "strum" {
54 + if eq_path_str(path, "strum") {
55 Some(nested)
56 } else {
57 None
58 @@ -24,11 +24,11 @@
59 .flat_map(|prop| prop)
60 .filter_map(|prop| match *prop {
61 NestedMeta::Meta(Meta::List(MetaList {
62 - ref ident,
63 + ref path,
64 ref nested,
65 ..
66 })) => {
67 - if ident == "props" {
68 + if eq_path_str(path, "props") {
69 Some(nested)
70 } else {
71 None
72 @@ -40,8 +40,8 @@
73 // Only look at key value pairs
74 .filter_map(|prop| match *prop {
75 NestedMeta::Meta(Meta::NameValue(MetaNameValue {
76 - ref ident, ref lit, ..
77 - })) => Some((ident, lit)),
78 + ref path, ref lit, ..
79 + })) => Some((&path.segments[0].ident, lit)),
80 _ => None,
81 })
82 .collect()
83 --- a/src/helpers.rs
84 +++ b/src/helpers.rs
85 @@ -1,12 +1,12 @@
86 use heck::{CamelCase, KebabCase, MixedCase, ShoutySnakeCase, SnakeCase, TitleCase};
87 -use syn::{Attribute, Ident, Meta, MetaList};
88 +use syn::{Attribute, Ident, Meta, MetaList, Path};
89
90 use case_style::CaseStyle;
91
92 pub fn extract_meta(attrs: &[Attribute]) -> Vec<Meta> {
93 attrs
94 .iter()
95 - .filter_map(|attribute| attribute.interpret_meta())
96 + .flat_map(|attribute| attribute.parse_meta())
97 .collect()
98 }
99
100 @@ -57,7 +57,7 @@
101 where
102 MetaIt: Iterator<Item = &'meta Meta>,
103 {
104 - filter_meta_lists(metas, move |metalist| metalist.ident == attr)
105 + filter_meta_lists(metas, move |metalist| eq_path_str(&metalist.path, attr))
106 }
107
108 /// Returns the `MetaList` that matches the given name from the list of `Meta`s, or `None`.
109 @@ -89,7 +89,7 @@
110 /// Returns the `Ident` of the `Meta::Word`, or `None`.
111 pub fn get_meta_ident<'meta>(meta: &'meta Meta) -> Option<&'meta Ident> {
112 match *meta {
113 - Meta::Word(ref ident) => Some(ident),
114 + Meta::Path(ref path) => Some(&path.segments[0].ident),
115 _ => None,
116 }
117 }
118 @@ -100,7 +100,7 @@
119 // Get all the attributes with our tag on them.
120 .filter_map(|meta| match *meta {
121 Meta::List(ref metalist) => {
122 - if metalist.ident == attr {
123 + if eq_path_str(&metalist.path, attr) {
124 Some(&metalist.nested)
125 } else {
126 None
127 @@ -112,11 +112,11 @@
128 // Get all the inner elements as long as they start with ser.
129 .filter_map(|meta| match *meta {
130 NestedMeta::Meta(Meta::NameValue(MetaNameValue {
131 - ref ident,
132 + ref path,
133 lit: Lit::Str(ref s),
134 ..
135 })) => {
136 - if ident == prop {
137 + if eq_path_str(path, prop) {
138 Some(s.value())
139 } else {
140 None
141 @@ -160,3 +160,13 @@
142 ident_string
143 }
144 }
145 +
146 +/// Checks whether the path is equal to the given string.
147 +///
148 +/// Returns `true` if they are same.
149 +///
150 +/// Note that the given string should be a single path segment.
151 +/// In other words, it should not be multi-segment path like `a::b::c`.
152 +pub fn eq_path_str(path: &Path, s: &str) -> bool {
153 + path.get_ident().map_or(false, |ident| ident == s)
154 +}