From 37ca438c9ac58448ecf304b735e71644e8127f3d Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Thu, 24 Jun 2021 15:20:40 -0700 Subject: [PATCH] Remove inner attributes from non-block expressions. --- src/expressions/array-expr.md | 9 +-------- src/expressions/grouped-expr.md | 9 +-------- src/expressions/struct-expr.md | 10 +--------- src/expressions/tuple-expr.md | 9 +-------- 4 files changed, 4 insertions(+), 33 deletions(-) diff --git a/src/expressions/array-expr.md b/src/expressions/array-expr.md index 5f50f09cb..65b3e2491 100644 --- a/src/expressions/array-expr.md +++ b/src/expressions/array-expr.md @@ -4,7 +4,7 @@ > **Syntax**\ > _ArrayExpression_ :\ ->    `[` [_InnerAttribute_]\* _ArrayElements_? `]` +>    `[` _ArrayElements_? `]` > > _ArrayElements_ :\ >       [_Expression_] ( `,` [_Expression_] )\* `,`?\ @@ -46,10 +46,6 @@ const EMPTY: Vec = Vec::new(); [EMPTY; 2]; ``` -### Array expression attributes - -[Inner attributes] are allowed directly after the opening bracket of an array expression in the same expression contexts as [attributes on block expressions]. - ## Array and slice indexing expressions > **Syntax**\ @@ -89,11 +85,8 @@ The array index expression can be implemented for types other than arrays and sl [`Copy`]: ../special-types-and-traits.md#copy [IndexMut]: ../../std/ops/trait.IndexMut.html [Index]: ../../std/ops/trait.Index.html -[Inner attributes]: ../attributes.md [_Expression_]: ../expressions.md -[_InnerAttribute_]: ../attributes.md [array]: ../types/array.md -[attributes on block expressions]: block-expr.md#attributes-on-block-expressions [constant expression]: ../const_eval.md#constant-expressions [constant item]: ../items/constant-items.md [literal]: ../tokens.md#literals diff --git a/src/expressions/grouped-expr.md b/src/expressions/grouped-expr.md index d76e9a1e0..0ff7e2c90 100644 --- a/src/expressions/grouped-expr.md +++ b/src/expressions/grouped-expr.md @@ -2,7 +2,7 @@ > **Syntax**\ > _GroupedExpression_ :\ ->    `(` [_InnerAttribute_]\* [_Expression_] `)` +>    `(` [_Expression_] `)` A *parenthesized expression* wraps a single expression, evaluating to that expression. The syntax for a parenthesized expression is a `(`, then an expression, called the *enclosed operand*, and then a `)`. @@ -39,12 +39,5 @@ assert_eq!( a.f (), "The method f"); assert_eq!((a.f)(), "The field f"); ``` -## Group expression attributes - -[Inner attributes] are allowed directly after the opening parenthesis of a group expression in the same expression contexts as [attributes on block expressions]. - -[Inner attributes]: ../attributes.md [_Expression_]: ../expressions.md -[_InnerAttribute_]: ../attributes.md -[attributes on block expressions]: block-expr.md#attributes-on-block-expressions [place]: ../expressions.md#place-expressions-and-value-expressions diff --git a/src/expressions/struct-expr.md b/src/expressions/struct-expr.md index ad9fb76f8..a6958e1f0 100644 --- a/src/expressions/struct-expr.md +++ b/src/expressions/struct-expr.md @@ -7,7 +7,7 @@ >    | _StructExprUnit_ > > _StructExprStruct_ :\ ->    [_PathInExpression_] `{` [_InnerAttribute_]\* (_StructExprFields_ | _StructBase_)? `}` +>    [_PathInExpression_] `{` (_StructExprFields_ | _StructBase_)? `}` > > _StructExprFields_ :\ >    _StructExprField_ (`,` _StructExprField_)\* (`,` _StructBase_ | `,`?) @@ -21,7 +21,6 @@ > > _StructExprTuple_ :\ >    [_PathInExpression_] `(`\ ->       [_InnerAttribute_]\*\ >       ( [_Expression_] (`,` [_Expression_])\* `,`? )?\ >    `)` > @@ -122,17 +121,10 @@ let a = Gamma; // Gamma unit value. let b = Gamma{}; // Exact same value as `a`. ``` -## Struct expression attributes - -[Inner attributes] are allowed directly after the opening brace or parenthesis of a struct expression in the same expression contexts as [attributes on block expressions]. - [IDENTIFIER]: ../identifiers.md -[Inner attributes]: ../attributes.md [TUPLE_INDEX]: ../tokens.md#tuple-index [_Expression_]: ../expressions.md -[_InnerAttribute_]: ../attributes.md [_PathInExpression_]: ../paths.md#paths-in-expressions -[attributes on block expressions]: block-expr.md#attributes-on-block-expressions [call expression]: call-expr.md [enum variant]: ../items/enumerations.md [if let]: if-expr.md#if-let-expressions diff --git a/src/expressions/tuple-expr.md b/src/expressions/tuple-expr.md index e9b1654c2..a6ac1c962 100644 --- a/src/expressions/tuple-expr.md +++ b/src/expressions/tuple-expr.md @@ -4,7 +4,7 @@ > **Syntax**\ > _TupleExpression_ :\ ->    `(` [_InnerAttribute_]\* _TupleElements_? `)` +>    `(` _TupleElements_? `)` > > _TupleElements_ :\ >    ( [_Expression_] `,` )+ [_Expression_]? @@ -29,10 +29,6 @@ Examples of tuple expressions and their types: | `("x".to_string(), )` | `(String, )` | | `("a", 4usize, true)`| `(&'static str, usize, bool)` | -### Tuple expression attributes - -[Inner attributes] are allowed directly after the opening parenthesis of a tuple expression in the same expression contexts as [attributes on block expressions]. - ## Tuple indexing expressions > **Syntax**\ @@ -70,13 +66,10 @@ assert_eq!(point.1, 0.0); > **Note**: Although arrays and slices also have elements, you must use an [array or slice indexing expression] or a [slice pattern] to access their elements. [_Expression_]: ../expressions.md -[_InnerAttribute_]: ../attributes.md [array or slice indexing expression]: array-expr.md#array-and-slice-indexing-expressions -[attributes on block expressions]: block-expr.md#attributes-on-block-expressions [call expression]: ./call-expr.md [decimal literal]: ../tokens.md#integer-literals [field access expressions]: ./field-expr.html#field-access-expressions -[inner attributes]: ../attributes.md [operands]: ../expressions.md [parenthetical expression]: grouped-expr.md [place expression]: ../expressions.md#place-expressions-and-value-expressions