Skip to content

Commit a004af2

Browse files
committed
Apply Suggestions
1 parent cabce65 commit a004af2

File tree

2 files changed

+25
-31
lines changed

2 files changed

+25
-31
lines changed

Diff for: src/const_eval.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ Conversely, the following are possible in a const function, but not in a const c
119119
[Const parameters]: items/generics.md
120120
[dereference operator]: expressions/operator-expr.md#the-dereference-operator
121121
[destructors]: destructors.md
122-
[enum discriminants]: items/enumerations.md#custom-discriminant-values-for-fieldless-enumerations
122+
[enum discriminants]: items/enumerations.md#discriminants
123123
[expression statements]: statements.md#expression-statements
124124
[expressions]: expressions.md
125125
[field]: expressions/field-expr.md

Diff for: src/items/enumerations.md

+24-30
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ In this example, `Cat` is a _struct-like enum variant_, whereas `Dog` is simply
5959
called an enum variant.
6060

6161
An enum where no constructors contain fields are called a
62-
*<a name="field-less-enum">field-less enum</a>*.
62+
*<a id="field-less-enum">field-less enum</a>*.
6363

6464
## Discriminants
6565

@@ -77,36 +77,30 @@ another means of distinguishing variants) in its actual memory layout.
7777
In two circumstances, the discriminant of a variant may be explicitly set by
7878
following the variant name with `=` and a [constant expression]:
7979

80-
<ol>
81-
<li>
8280

83-
if the enumeration is "C-like" (i.e., it has no tuple or struct variants); e.g.:
84-
85-
```rust
86-
enum Enum {
87-
Foo = 3,
88-
Bar = 2,
89-
Baz = 1,
90-
}
91-
```
92-
</li>
93-
<li>
94-
95-
if a [primitive representation] is used. For example:
96-
97-
```rust
98-
#[repr(u8)]
99-
enum Enum {
100-
Unit = 3,
101-
Tuple(u16),
102-
Struct {
103-
a: u8,
104-
b: u16,
105-
} = 1,
106-
}
107-
```
108-
</li>
109-
</ol>
81+
1. if the enumeration is fieldless; e.g.:
82+
83+
```rust
84+
enum Enum {
85+
Foo = 3,
86+
Bar() = 2,
87+
Baz {} = 1,
88+
}
89+
```
90+
91+
2. if a [primitive representation] is used. For example:
92+
93+
```rust
94+
#[repr(u8)]
95+
enum Enum {
96+
Unit = 3,
97+
Tuple(u16),
98+
Struct {
99+
a: u8,
100+
b: u16,
101+
} = 1,
102+
}
103+
```
110104

111105
#### Implicit Discriminants
112106

0 commit comments

Comments
 (0)