Skip to content

Commit

Permalink
Merge pull request #2627 from evanj/patch-1
Browse files Browse the repository at this point in the history
minor clarification about deriving Copy and Clone
  • Loading branch information
carols10cents committed Feb 23, 2021
2 parents 74edb8d + bb8f6cc commit 21fcf07
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/appendix-03-derivable-traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ overloading those methods and violating the assumption that no arbitrary code
is being run. That way, all programmers can assume that copying a value will be
very fast.

You can derive `Copy` on any type whose parts all implement `Copy`. You can
only apply the `Copy` trait to types that also implement `Clone`, because a
type that implements `Copy` has a trivial implementation of `Clone` that
performs the same task as `Copy`.
You can derive `Copy` on any type whose parts all implement `Copy`. A type that
implements `Copy` must also implement `Clone`, because a type that implements
`Copy` has a trivial implementation of `Clone` that performs the same task as
`Copy`.

The `Copy` trait is rarely required; types that implement `Copy` have
optimizations available, meaning you don’t have to call `clone`, which makes
Expand Down

0 comments on commit 21fcf07

Please sign in to comment.