mirror of
https://gitee.com/openharmony/third_party_rust_syn
synced 2024-11-23 16:00:10 +00:00
Merge pull request #1158 from frank2/rangelimits-to-tokens
#1157 implement ToTokens for RangeLimits enum
This commit is contained in:
commit
d94e7f191b
16
src/expr.rs
16
src/expr.rs
@ -3344,16 +3344,24 @@ pub(crate) mod printing {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "full")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))]
|
||||
impl ToTokens for RangeLimits {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream) {
|
||||
match self {
|
||||
RangeLimits::HalfOpen(t) => t.to_tokens(tokens),
|
||||
RangeLimits::Closed(t) => t.to_tokens(tokens),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "full")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))]
|
||||
impl ToTokens for ExprRange {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream) {
|
||||
outer_attrs_to_tokens(&self.attrs, tokens);
|
||||
self.from.to_tokens(tokens);
|
||||
match &self.limits {
|
||||
RangeLimits::HalfOpen(t) => t.to_tokens(tokens),
|
||||
RangeLimits::Closed(t) => t.to_tokens(tokens),
|
||||
}
|
||||
self.limits.to_tokens(tokens);
|
||||
self.to.to_tokens(tokens);
|
||||
}
|
||||
}
|
||||
|
@ -878,10 +878,7 @@ mod printing {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream) {
|
||||
tokens.append_all(self.attrs.outer());
|
||||
self.lo.to_tokens(tokens);
|
||||
match &self.limits {
|
||||
RangeLimits::HalfOpen(t) => t.to_tokens(tokens),
|
||||
RangeLimits::Closed(t) => t.to_tokens(tokens),
|
||||
}
|
||||
self.limits.to_tokens(tokens);
|
||||
self.hi.to_tokens(tokens);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user