Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 9 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions ff_derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ bits = []
proc-macro = true

[dependencies]
addchain = "0.2"
num-bigint = "0.3"
addchain = "0.3"
num-bigint = "0.4"
num-traits = "0.2"
num-integer = "0.1"
proc-macro2 = "1"
quote = "1"
syn = { version = "1", features = ["full"] }
syn = { version = "2", features = ["full"] }
Comment thread
ebfull marked this conversation as resolved.

[badges]
maintenance = { status = "passively-maintained" }
19 changes: 6 additions & 13 deletions ff_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,21 +302,14 @@ fn validate_struct(ast: &syn::DeriveInput, limbs: usize) -> Option<proc_macro2::
/// Fetch an attribute string from the derived struct.
fn fetch_attr(name: &str, attrs: &[syn::Attribute]) -> Option<String> {
for attr in attrs {
if let Ok(meta) = attr.parse_meta() {
match meta {
syn::Meta::NameValue(nv) => {
if nv.path.get_ident().map(|i| i.to_string()) == Some(name.to_string()) {
match nv.lit {
syn::Lit::Str(ref s) => return Some(s.value()),
_ => {
panic!("attribute {} should be a string", name);
}
}
if let syn::Meta::NameValue(nv) = &attr.meta {
if nv.path.get_ident().map(|i| i.to_string()) == Some(name.to_string()) {
if let syn::Expr::Lit(expr_lit) = &nv.value {
if let syn::Lit::Str(ref s) = expr_lit.lit {
return Some(s.value());
}
}
_ => {
panic!("attribute {} should be a string", name);
}
panic!("attribute {} should be a string", name);
}
}
}
Expand Down
Loading