dtolnay / quote

Rust quasi-quoting
Apache License 2.0
1.32k stars 90 forks source link

Allow any `impl Spanned` for `quote_spanned!` #231

Closed Kyuuhachi closed 2 months ago

Kyuuhachi commented 2 years ago

In almost all cases I find myself using the span of an existing AST node, so needing to write .span()=> everywhere is a lot of visual noise. And since Span is impl Spanned, I believe this would be backward compatible (though there could very well be some sort of special case I have not thought of). Would this be a reasonable change, or is there some reason it is not so?

dtolnay commented 2 months ago

I think this is all right as currently implemented, with .span()=> required if the desired span is the span of an AST node.

In my own macros I prefer avoiding Spanned, so adding a new implicit application of it would be counterproductive.