A space after colons in macros


I note that while style guide says “Use a space after colons”, almost no existing codes does so in macros. For example,

macro_rules! try(
    ($e:expr) => (match $e { Ok(e) => e, Err(e) => return Err(e) })

That is, $e:expr, not $e: expr.

What do you prefer?


Former. No reason, other than everyone else follows that style too.


I try to use $e: expr because the expr is essentially a type for the $e variable.


I prefer $e:expr, it makes it clear that expr is part of the nonterminal pattern token.


I personally prefer $e: expr, it seems more consistent to me. I actually tend to be confused/surprised for a second, whenever I come across the space-less variant.


Oh, everything makes sense now. I couldn’t even parse the syntax for macro_rules! because it just looked like magic macro things.