Skip to content

Commit

Permalink
Merge pull request #4136 from dane/ch04-reword-it
Browse files Browse the repository at this point in the history
Revise sentence to not refer to two subjects as it
  • Loading branch information
chriskrycho authored Dec 5, 2024
2 parents 9900d97 + d65bd3c commit 2f3bdf2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ fn main() {
// ANCHOR: here
fn calculate_length(s: &String) -> usize { // s is a reference to a String
s.len()
} // Here, s goes out of scope. But because it does not have ownership of what
// it refers to, it is not dropped.
} // Here, s goes out of scope. But because s does not have ownership of what
// it refers to, the value is not dropped.
// ANCHOR_END: here
4 changes: 2 additions & 2 deletions src/ch04-02-references-and-borrowing.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ Let’s take a closer look at the function call here:
```

The `&s1` syntax lets us create a reference that _refers_ to the value of `s1`
but does not own it. Because it does not own it, the value it points to will
not be dropped when the reference stops being used.
but does not own it. Because the reference does not own it, the value it points
to will not be dropped when the reference stops being used.

Likewise, the signature of the function uses `&` to indicate that the type of
the parameter `s` is a reference. Let’s add some explanatory annotations:
Expand Down

0 comments on commit 2f3bdf2

Please sign in to comment.