mirror of
https://gitee.com/openharmony/third_party_rust_quote
synced 2024-11-23 15:19:40 +00:00
Merge pull request #203 from dtolnay/parse
Optimize parse+extend to make only one proc macro bridge call
This commit is contained in:
commit
0a04bae97b
@ -1,5 +1,6 @@
|
|||||||
use crate::{IdentFragment, ToTokens, TokenStreamExt};
|
use crate::{IdentFragment, ToTokens, TokenStreamExt};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
use std::iter;
|
||||||
use std::ops::BitOr;
|
use std::ops::BitOr;
|
||||||
|
|
||||||
pub use proc_macro2::*;
|
pub use proc_macro2::*;
|
||||||
@ -178,7 +179,7 @@ pub fn push_group_spanned(
|
|||||||
|
|
||||||
pub fn parse(tokens: &mut TokenStream, s: &str) {
|
pub fn parse(tokens: &mut TokenStream, s: &str) {
|
||||||
let s: TokenStream = s.parse().expect("invalid token stream");
|
let s: TokenStream = s.parse().expect("invalid token stream");
|
||||||
tokens.extend(s);
|
tokens.extend(iter::once(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse_spanned(tokens: &mut TokenStream, span: Span, s: &str) {
|
pub fn parse_spanned(tokens: &mut TokenStream, span: Span, s: &str) {
|
||||||
|
Loading…
Reference in New Issue
Block a user