mirror of
https://gitee.com/openharmony/third_party_rust_syn
synced 2024-11-27 09:50:41 +00:00
#1157 implement ToTokens for RangeLimits enum
This commit is contained in:
parent
86c9fa49f5
commit
72e6ffc681
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