Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to recent versions of the quote, syn and proc_macro2 crates #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions test-generator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ proc-macro = true

[dependencies]
glob = "^0.3"
quote = "0.6"
syn = { version="^0.15", features=["full"] }
proc-macro2 = "^0.4"
quote = "1.0"
syn = { version="1.0", features=["full"] }
proc-macro2 = "1.0"
16 changes: 8 additions & 8 deletions test-generator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ pub fn test_resources(attrs: TokenStream, func: TokenStream) -> TokenStream {
Lit::Byte(l) => panic!(format!("expected string parameter, got '{}'", &l.value())),
Lit::ByteStr(_) => panic!("expected string parameter, got byte-string"),
Lit::Char(l) => panic!(format!("expected string parameter, got '{}'", &l.value())),
Lit::Int(l) => panic!(format!("expected string parameter, got '{}'", &l.value())),
Lit::Float(l) => panic!(format!("expected string parameter, got '{}'", &l.value())),
Lit::Int(l) => panic!(format!("expected string parameter, got '{}'", l)),
Lit::Float(l) => panic!(format!("expected string parameter, got '{}'", l)),
_ => panic!("expected string parameter"),
};

Expand All @@ -241,7 +241,7 @@ pub fn test_resources(attrs: TokenStream, func: TokenStream) -> TokenStream {
let func_ast: ItemFn = syn::parse(func)
.expect("failed to parse tokens as a function");

let func_ident = func_ast.ident;
let func_ident = func_ast.sig.ident;

let paths: Paths = glob(&pattern).expect(&format!("No such file or directory {}", &pattern));

Expand Down Expand Up @@ -351,8 +351,8 @@ pub fn bench_resources(attrs: TokenStream, func: TokenStream) -> TokenStream {
Lit::Byte(l) => panic!(format!("expected string parameter, got '{}'", &l.value())),
Lit::ByteStr(_) => panic!("expected string parameter, got byte-string"),
Lit::Char(l) => panic!(format!("expected string parameter, got '{}'", &l.value())),
Lit::Int(l) => panic!(format!("expected string parameter, got '{}'", &l.value())),
Lit::Float(l) => panic!(format!("expected string parameter, got '{}'", &l.value())),
Lit::Int(l) => panic!(format!("expected string parameter, got '{}'", l)),
Lit::Float(l) => panic!(format!("expected string parameter, got '{}'", l)),
_ => panic!("expected string parameter"),
};

Expand All @@ -361,7 +361,7 @@ pub fn bench_resources(attrs: TokenStream, func: TokenStream) -> TokenStream {
let func_ast: ItemFn = syn::parse(func)
.expect("failed to parse tokens as a function");

let func_ident = func_ast.ident;
let func_ident = func_ast.sig.ident;

let paths: Paths = glob(&pattern).expect(&format!("No such file or directory {}", &pattern));

Expand Down Expand Up @@ -572,7 +572,7 @@ fn expr_stringified(expr: &Expr, int_as_hex: bool) -> String {
attrs: _,
} => match litval {
Lit::Int(lit) => {
let val = lit.value();
let val: u64 = lit.base10_parse().unwrap();
if int_as_hex {
// if u8-range, use two digits, otherwise 16
if val > 255 {
Expand All @@ -594,7 +594,7 @@ fn expr_stringified(expr: &Expr, int_as_hex: bool) -> String {
val
}
Lit::Float(lit) => {
let val = lit.value();
let val: f64 = lit.base10_parse().unwrap();
format!("{}", val)
}
_ => panic!(),
Expand Down