-
Copying this over from Discord, I need some help transforming functions with a specific decorator on them.
impl VisitMut for TransformVisitor {
fn visit_mut_function(&mut self, n: &mut Function) {
if n.decorators.len() > 0
&& n.decorators.iter().any(|dec| {
if dec.expr.is_call() && dec.expr.as_call().is_some().to_string() == "RPC" {
true
} else {
false
}
})
{
match &n.body {
Some(x) => {
x.stmts.clear();
},
None => {},
}
}
}
} But I get a borrow checker error with |
Beta Was this translation helpful? Give feedback.
Answered by
kdy1
Jul 13, 2023
Replies: 1 comment
-
Try match &mut n.body {
Some(x) => {
x.stmts.clear();
},
None => {},
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
kdy1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try