tikv/minitrace-rust

Proc-macro: Rationalize function signature logic (transform_sig)

taqtiqa-mark opened this issue · 1 comments

Once proc-macro-attribute #[trace(...)] has test coverage and documentation covering the relevant code, it may be possible to simplify the logic within minitrace-macro/lib: transform_sig(...). Specifically, by eliminating these lines, (per this observation in PR #119):

for (i, arg) in sig.inputs.iter_mut().enumerate() {
match arg {
FnArg::Receiver(Receiver {
reference: Some(_), ..
}) => {}
FnArg::Receiver(arg) => arg.mutability = None,
FnArg::Typed(arg) => {
if let Pat::Ident(ident) = &mut *arg.pat {
ident.by_ref = None;
} else {
let positional = positional_arg(i, &arg.pat);
let m = mut_pat(&mut arg.pat);
arg.pat = parse_quote!(#m #positional);
}
}
}
}

Voided by PR #127 rejection.