Skip to content

Clarify Copy trait, "l" letter to quoted #2418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/ch04-01-what-is-ownership.md
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,13 @@ we add the `Copy` annotation to that type, we’ll get a compile-time error. To
learn about how to add the `Copy` annotation to your type, see [“Derivable
Traits”][derivable-traits]<!-- ignore --> in Appendix C.

So what types are `Copy`? You can check the documentation for the given type to
be sure, but as a general rule, any group of simple scalar values can be
`Copy`, and nothing that requires allocation or is some form of resource is
`Copy`. Here are some of the types that are `Copy`:
So what types are `Copy`able? You can check the documentation for the given type to
be sure, but as a general rule:

1. Any group of simple scalar values can have the `Copy` trait,
2. Nothing that requires allocation or is some form of resource is `Copy`able.

Here are some of the types that are `Copy`able:

* All the integer types, such as `u32`.
* The Boolean type, `bool`, with values `true` and `false`.
Expand Down
2 changes: 1 addition & 1 deletion src/ch08-02-strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ If the `push_str` method took ownership of `s2`, we wouldn’t be able to print
its value on the last line. However, this code works as we’d expect!

The `push` method takes a single character as a parameter and adds it to the
`String`. Listing 8-17 shows code that adds the letter *l* to a `String` using
`String`. Listing 8-17 shows code that adds the letter "l" to a `String` using
the `push` method.

```rust
Expand Down