Skip to content

Commit 063eaf0

Browse files
sphynxTeXitoi
authored andcommitted
Update deprecated function and provide more info about the parsing error (#193)
1 parent 8068f96 commit 063eaf0

2 files changed

Lines changed: 20 additions & 21 deletions

File tree

structopt-derive/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ license = "Apache-2.0/MIT"
1313
travis-ci = { repository = "TeXitoi/structopt" }
1414

1515
[dependencies]
16-
syn = "0.15"
16+
syn = "0.15.10"
1717
quote = "0.6"
1818
proc-macro2 = "0.4"
1919
heck = "^0.3.0"

structopt-derive/src/attrs.rs

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -153,26 +153,25 @@ impl Attrs {
153153
use Meta::*;
154154
use NestedMeta::*;
155155

156-
let structopt_attrs =
157-
attrs
158-
.iter()
159-
.filter_map(|attr| {
160-
let path = &attr.path;
161-
match quote!(#path).to_string().as_ref() {
162-
"structopt" => Some(attr.interpret_meta().unwrap_or_else(|| {
163-
panic!("invalid structopt syntax: {}", quote!(#attr))
164-
})),
165-
_ => None,
166-
}
167-
})
168-
.flat_map(|m| match m {
169-
List(l) => l.nested,
170-
tokens => panic!("unsupported syntax: {}", quote!(#tokens).to_string()),
171-
})
172-
.map(|m| match m {
173-
Meta(m) => m,
174-
ref tokens => panic!("unsupported syntax: {}", quote!(#tokens).to_string()),
175-
});
156+
let structopt_attrs = attrs
157+
.iter()
158+
.filter_map(|attr| {
159+
let path = &attr.path;
160+
match quote!(#path).to_string().as_ref() {
161+
"structopt" => Some(attr.parse_meta().unwrap_or_else(|e| {
162+
panic!("invalid structopt syntax: {}: {}", e, quote!(#attr))
163+
})),
164+
_ => None,
165+
}
166+
})
167+
.flat_map(|m| match m {
168+
List(l) => l.nested,
169+
tokens => panic!("unsupported syntax: {}", quote!(#tokens).to_string()),
170+
})
171+
.map(|m| match m {
172+
Meta(m) => m,
173+
ref tokens => panic!("unsupported syntax: {}", quote!(#tokens).to_string()),
174+
});
176175

177176
for attr in structopt_attrs {
178177
match attr {

0 commit comments

Comments
 (0)