Validate paths in disallowed_*
configurations by smoelius · Pull Request #14397 · rust-lang/rust-clippy (original) (raw)
I'm trying to apply a "trick" that I learned from the default_text macro defined in the same file.
Specifically, on this line, the replacements_allowed
argument is included only if the disallowed_path_replacements_allowed
attribute was used:
deserialize!(map, ty,errors,self.0ty, errors, self.0 ty,errors,self.0(, $replacements_allowed)?);
In this way, the presence/absence of that argument selects between the two arms in the deserialize!
macro.
Your suggestion is to use a keyword to choose between the two arms, correct?
I take your point that the present code is subtle and non-obvious. But, to be honest, I cannot immediately see how to make the keyword approach work. Could you offer me some more guidance? Or is there a way to make the present code more clear?
(Sorry if the "trick" explanation was unnecessary.)