summaryrefslogtreecommitdiff
path: root/subplotlib-derive/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'subplotlib-derive/src/lib.rs')
-rw-r--r--subplotlib-derive/src/lib.rs21
1 files changed, 8 insertions, 13 deletions
diff --git a/subplotlib-derive/src/lib.rs b/subplotlib-derive/src/lib.rs
index 7aef0dc..8e18c98 100644
--- a/subplotlib-derive/src/lib.rs
+++ b/subplotlib-derive/src/lib.rs
@@ -8,7 +8,7 @@ use syn::{
use quote::quote;
-use fehler::{throw, throws};
+use culpa::{throw, throws};
fn ty_is_borrow_str(ty: &Type) -> bool {
if let Type::Reference(ty) = ty {
@@ -209,19 +209,19 @@ fn process_step(mut input: ItemFn) -> proc_macro2::TokenStream {
let contexts: Vec<Type> = input
.attrs
.iter()
- .filter(|attr| attr.path.is_ident("context"))
+ .filter(|attr| attr.path().is_ident("context"))
.map(|attr| {
let ty: Type = attr.parse_args()?;
Ok(ty)
})
.collect::<Result<_, Error>>()?;
- input.attrs.retain(|f| !f.path.is_ident("context"));
+ input.attrs.retain(|f| !f.path().is_ident("context"));
let docs: Vec<_> = input
.attrs
.iter()
- .filter(|attr| attr.path.is_ident("doc"))
+ .filter(|attr| attr.path().is_ident("doc"))
.collect();
let fields = input
@@ -350,10 +350,11 @@ fn process_step(mut input: ItemFn) -> proc_macro2::TokenStream {
impl Builder {
#(#fieldfns)*
- pub fn build(self, step_text: String) -> ScenarioStep {
+ pub fn build(self, step_text: String, location: &'static str) -> ScenarioStep {
ScenarioStep::new(step_text, move |ctx, _defuse_poison|
#builder_body,
- |scenario| register_contexts(scenario)
+ |scenario| register_contexts(scenario),
+ location,
)
}
}
@@ -403,10 +404,7 @@ fn process_step(mut input: ItemFn) -> proc_macro2::TokenStream {
for context in outer_ctx.into_iter().chain(contexts.iter()) {
write!(contextattrs, "\n #[context({:?})]", ty_as_path(context)?).unwrap();
}
- let func_args: Vec<_> = fields
- .iter()
- .map(|(ident, _)| format!("{}", ident))
- .collect();
+ let func_args: Vec<_> = fields.iter().map(|(ident, _)| format!("{ident}")).collect();
let func_args = func_args.join(", ");
format!(
r#"
@@ -424,9 +422,6 @@ fn process_step(mut input: ItemFn) -> proc_macro2::TokenStream {
}}
```
"#,
- stepname = stepname,
- contextattrs = contextattrs,
- func_args = func_args,
)
};
let ret = quote! {