Skip to content

Commit 516a5b5

Browse files
committed
Provide Expr::Group even with features="full" off
1 parent cac5cc6 commit 516a5b5

File tree

9 files changed

+23
-22
lines changed

9 files changed

+23
-22
lines changed

src/expr.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ ast_struct! {
407407
/// of expressions and is related to `None`-delimited spans in a
408408
/// `TokenStream`.
409409
#[cfg_attr(doc_cfg, doc(cfg(feature = "full")))]
410-
pub struct ExprGroup #full {
410+
pub struct ExprGroup {
411411
pub attrs: Vec<Attribute>,
412412
pub group_token: token::Group,
413413
pub expr: Box<Expr>,
@@ -1651,7 +1651,13 @@ pub(crate) mod parsing {
16511651

16521652
#[cfg(not(feature = "full"))]
16531653
fn atom_expr(input: ParseStream, _allow_struct: AllowStruct) -> Result<Expr> {
1654-
if input.peek(Lit) {
1654+
if input.peek(token::Group)
1655+
&& !input.peek2(Token![::])
1656+
&& !input.peek2(Token![!])
1657+
&& !input.peek2(token::Brace)
1658+
{
1659+
input.call(expr_group).map(Expr::Group)
1660+
} else if input.peek(Lit) {
16551661
input.parse().map(Expr::Lit)
16561662
} else if input.peek(token::Paren) {
16571663
input.call(expr_paren).map(Expr::Paren)
@@ -1906,7 +1912,6 @@ pub(crate) mod parsing {
19061912
}
19071913
}
19081914

1909-
#[cfg(feature = "full")]
19101915
fn expr_group(input: ParseStream) -> Result<ExprGroup> {
19111916
let group = crate::group::parse_group(input)?;
19121917
Ok(ExprGroup {
@@ -2958,7 +2963,6 @@ pub(crate) mod printing {
29582963
}
29592964
}
29602965

2961-
#[cfg(feature = "full")]
29622966
#[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))]
29632967
impl ToTokens for ExprGroup {
29642968
fn to_tokens(&self, tokens: &mut TokenStream) {

src/gen/clone.rs

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/gen/debug.rs

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/gen/eq.rs

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/gen/fold.rs

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/gen/hash.rs

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/gen/visit.rs

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/gen/visit_mut.rs

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

syn.json

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)