Skip to content

Commit 4156633

Browse files
authored
Merge pull request #272 from matthewjasper/formatting-fixes
Formatting fixes
2 parents b6d4ed7 + cfcae23 commit 4156633

File tree

3 files changed

+47
-46
lines changed

3 files changed

+47
-46
lines changed

src/expressions/match-expr.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
# `match` expressions
22

3-
> **<sup>Syntax</sup>**
4-
> _MatchExpression_ :
5-
> &nbsp;&nbsp; `match` [_Expression_]<sub>_except struct expression_</sub> `{`
6-
> &nbsp;&nbsp; &nbsp;&nbsp; [_InnerAttribute_]<sup>\*</sup>
7-
> &nbsp;&nbsp; &nbsp;&nbsp; _MatchArms_<sup>?</sup>
8-
> &nbsp;&nbsp; `}`
3+
> **<sup>Syntax</sup>**
4+
> _MatchExpression_ :
5+
> &nbsp;&nbsp; `match` [_Expression_]<sub>_except struct expression_</sub> `{`
6+
> &nbsp;&nbsp; &nbsp;&nbsp; [_InnerAttribute_]<sup>\*</sup>
7+
> &nbsp;&nbsp; &nbsp;&nbsp; _MatchArms_<sup>?</sup>
8+
> &nbsp;&nbsp; `}`
99
>
10-
> _MatchArms_ :
10+
> _MatchArms_ :
1111
> &nbsp;&nbsp; ( _MatchArm_ `=>`
1212
> ( [_BlockExpression_] `,`<sup>?</sup>
1313
> | [_Expression_] `,` )
14-
> )<sup>\*</sup>
15-
> &nbsp;&nbsp; _MatchArm_ `=>` ( [_BlockExpression_] | [_Expression_] ) `,`<sup>?</sup>
14+
> )<sup>\*</sup>
15+
> &nbsp;&nbsp; _MatchArm_ `=>` ( [_BlockExpression_] | [_Expression_] ) `,`<sup>?</sup>
1616
>
17-
> _MatchArm_ :
18-
> &nbsp;&nbsp; [_OuterAttribute_]<sup>\*</sup> _MatchArmPatterns_ _MatchArmGuard_<sup>?</sup>
17+
> _MatchArm_ :
18+
> &nbsp;&nbsp; [_OuterAttribute_]<sup>\*</sup> _MatchArmPatterns_ _MatchArmGuard_<sup>?</sup>
1919
>
20-
> _MatchArmPatterns_ :
21-
> &nbsp;&nbsp; `|`<sup>?</sup> _Pattern_ ( `|` _Pattern_ )<sup>\*</sup>
20+
> _MatchArmPatterns_ :
21+
> &nbsp;&nbsp; `|`<sup>?</sup> _Pattern_ ( `|` _Pattern_ )<sup>\*</sup>
2222
>
23-
> _MatchArmGuard_ :
23+
> _MatchArmGuard_ :
2424
> &nbsp;&nbsp; `if` [_Expression_]
2525
2626
A `match` expression branches on a *pattern*. The exact form of matching that

src/tokens.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -488,11 +488,11 @@ The two values of the boolean type are written `true` and `false`.
488488
## Lifetimes and loop labels
489489

490490
> **<sup>Lexer</sup>**
491-
> LIFETIME_TOKEN
491+
> LIFETIME_TOKEN :
492492
> &nbsp;&nbsp; &nbsp;&nbsp; `'` [IDENTIFIER_OR_KEYWORD][identifier]
493493
> &nbsp;&nbsp; | `'_`
494494
>
495-
> LIFETIME_OR_LABEL:
495+
> LIFETIME_OR_LABEL :
496496
> &nbsp;&nbsp; &nbsp;&nbsp; `'` [IDENTIFIER][identifier]
497497
498498
Lifetime parameters and [loop labels] use LIFETIME_OR_LABEL tokens. Any

src/types.md

+31-30
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ let foo_ptr_2 = if want_i32 {
342342
};
343343
```
344344

345-
All function items implement [Fn], [FnMut], [FnOnce], [Copy], [Clone], [Send],
346-
and [Sync].
345+
All function items implement [`Fn`], [`FnMut`], [`FnOnce`], [`Copy`],
346+
[`Clone]`, [`Send`], and [`Sync`].
347347

348348
## Function pointer types
349349

@@ -450,20 +450,20 @@ borrowed to iterate over, the code would not compile.
450450

451451
### Call traits and coercions
452452

453-
Closure types all implement `[FnOnce]`, indicating that they can be called once
453+
Closure types all implement [`FnOnce`], indicating that they can be called once
454454
by consuming ownership of the closure. Additionally, some closures implement
455455
more specific call traits:
456456

457457
* A closure which does not move out of any captured variables implements
458-
`[FnMut]`, indicating that it can be called by mutable reference.
458+
[`FnMut`], indicating that it can be called by mutable reference.
459459

460460
* A closure which does not mutate or move out of any captured variables
461-
implements `[Fn]`, indicating that it can be called by shared reference.
461+
implements [`Fn`], indicating that it can be called by shared reference.
462462

463-
> Note: `move` closures may still implement `[Fn]` or `[FnMut]`, even though
463+
> Note: `move` closures may still implement [`Fn`] or [`FnMut`], even though
464464
> they capture variables by move. This is because the traits implemented by a
465-
> closure type are determined by what the closure does with captured values, not
466-
> how it captures them.
465+
> closure type are determined by what the closure does with captured values,
466+
> not how it captures them.
467467
468468
*Non-capturing closures* are closures that don't capture anything from their
469469
environment. They can be coerced to function pointers (`fn`) with the matching
@@ -481,28 +481,28 @@ x = bo(5,7);
481481

482482
### Other traits
483483

484-
All closure types implement `[Sized]`. Additionally, closure types implement the
484+
All closure types implement [`Sized`]. Additionally, closure types implement the
485485
following traits if allowed to do so by the types of the captures it stores:
486486

487-
* `[Clone]`
488-
* `[Copy]`
489-
* `[Sync]`
490-
* `[Send]`
487+
* [`Clone`]
488+
* [`Copy`]
489+
* [`Sync`]
490+
* [`Send`]
491491

492-
The rules for `[Send]` and `[Sync]` match those for normal struct types, while
493-
`[Clone]` and `[Copy]` behave as if [derived][derive]. For `[Clone]`, the order
492+
The rules for [`Send`] and [`Sync`] match those for normal struct types, while
493+
[`Clone`] and [`Copy`] behave as if [derived][derive]. For [`Clone`], the order
494494
of cloning of the captured variables is left unspecified.
495495

496496
Because captures are often by reference, the following general rules arise:
497497

498-
* A closure is `[Sync]` if all variables captured by mutable reference, copy, or
499-
move are `[Sync]`.
500-
* A closure is `[Send]` if all variables captured by shared reference are
501-
`[Sync]`, and all values captured by mutable reference, copy, or move are
502-
`[Send]`.
503-
* A closure is `[Clone]` or `[Copy]` if it does not capture any values by
504-
mutable reference, and if all values it captures by copy or move are `[Clone]`
505-
or `[Copy]`, respectively.
498+
* A closure is [`Sync`] if all variables captured by mutable reference, copy,
499+
or move are [`Sync`].
500+
* A closure is [`Send`] if all variables captured by shared reference are
501+
[`Sync`], and all values captured by mutable reference, copy, or move are
502+
[`Send`].
503+
* A closure is [`Clone`] or [`Copy`] if it does not capture any values by
504+
mutable reference, and if all values it captures by copy or move are
505+
[`Clone`] or [`Copy`], respectively.
506506

507507
## Trait objects
508508

@@ -643,13 +643,14 @@ impl Printable for String {
643643

644644
> Note: The notation `&self` is a shorthand for `self: &Self`.
645645
646-
[Fn]: ../std/ops/trait.Fn.html
647-
[FnMut]: ../std/ops/trait.FnMut.html
648-
[FnOnce]: ../std/ops/trait.FnOnce.html
649-
[Copy]: special-types-and-traits.html#copy
650-
[Clone]: special-types-and-traits.html#clone
651-
[Send]: special-types-and-traits.html#send
652-
[Sync]: special-types-and-traits.html#sync
646+
[`Fn`]: ../std/ops/trait.Fn.html
647+
[`FnMut`]: ../std/ops/trait.FnMut.html
648+
[`FnOnce`]: ../std/ops/trait.FnOnce.html
649+
[`Copy`]: special-types-and-traits.html#copy
650+
[`Clone`]: special-types-and-traits.html#clone
651+
[`Send`]: special-types-and-traits.html#send
652+
[`Sync`]: special-types-and-traits.html#sync
653+
[`Sized`]: special-types-and-traits.html#sized
653654
[derive]: attributes.html#derive
654655
[`Vec<T>`]: ../std/vec/struct.Vec.html
655656
[dynamically sized type]: dynamically-sized-types.html

0 commit comments

Comments
 (0)