Skip to content

Commit d962646

Browse files
committed
Use correct syntax for code containing links.
1 parent 3f5c9c9 commit d962646

File tree

1 file changed

+31
-30
lines changed

1 file changed

+31
-30
lines changed

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)