macros.rs: refactor boilerplate code
This patch extracts some boilerplate code (converting between
proc_macro
and proc_macro2
) into a single function, to make the
code's intent a bit clearer.
As a side-benefit, it suppresses a clippy false-positive in a single place.