dtolnay / quote

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

Use `Ident::new_raw` when it's available #223

Closed mystor closed 2 years ago

mystor commented 2 years ago

The Ident::new_raw method has been stable since rustc 1.47.0 (https://doc.rust-lang.org/nightly/proc_macro/struct.Ident.html#method.new_raw). The logic for pushing raw identifiers into a TokenStream still uses TokenStream::from_str however, and could be updated to call this new_raw on versions where it's available.

https://github.com/dtolnay/quote/blob/7d5d36017b71a72d3bc6c4ab4f24fb372fb4f031/src/runtime.rs#L192-L202

https://github.com/dtolnay/quote/blob/7d5d36017b71a72d3bc6c4ab4f24fb372fb4f031/src/runtime.rs#L204-L214

https://github.com/dtolnay/quote/blob/7d5d36017b71a72d3bc6c4ab4f24fb372fb4f031/src/runtime.rs#L322-L335