mirror of https://github.com/rust-lang/book
Fix spelling mistakes that got in while CI spellchecking was broke :P
This commit is contained in:
parent
afda93783c
commit
7740400fec
|
@ -22,6 +22,7 @@ associativity
|
|||
async
|
||||
atomics
|
||||
attr
|
||||
autocompletion
|
||||
AveragedCollection
|
||||
backend
|
||||
backported
|
||||
|
@ -64,6 +65,7 @@ choo
|
|||
chXX
|
||||
chYY
|
||||
clippy
|
||||
clippy's
|
||||
coercions
|
||||
combinator
|
||||
ConcreteType
|
||||
|
|
|
@ -5,7 +5,7 @@ know about at this location in the code? What functions am I allowed to call?
|
|||
What does this variable refer to?
|
||||
|
||||
Rust has a number of features related to scopes. This is sometimes called
|
||||
“the module system,” but it encompases more than just modules:
|
||||
“the module system,” but it encompasses more than just modules:
|
||||
|
||||
* *Packages* are a Cargo feature that let you build, test, and share crates.
|
||||
* *Crates* are a tree of modules that produce a library or executable.
|
||||
|
|
|
@ -181,7 +181,7 @@ error[E0603]: module `instrument` is private
|
|||
<span class="caption">Listing 7-5: Compiler errors from building the code in
|
||||
Listing 7-4</span>
|
||||
|
||||
The error messsages say that module `instrument` is private. We can see that we
|
||||
The error messages say that module `instrument` is private. We can see that we
|
||||
have the correct paths for the `instrument` module and the `clarinet` function,
|
||||
but Rust won’t let us use them because they’re private. It’s time to learn
|
||||
about the `pub` keyword!
|
||||
|
|
|
@ -303,9 +303,10 @@ say we wanted to take two things that implement `Summary`:
|
|||
pub fn notify(item1: impl Summary, item2: impl Summary) {
|
||||
```
|
||||
|
||||
This would work well if `item1` and `item2` were allowed to have diferent types
|
||||
(as long as both implement `Summary`). But what if you wanted to force both to
|
||||
have the exact same type? That is only possible if you use a trait bound:
|
||||
This would work well if `item1` and `item2` were allowed to have different
|
||||
types (as long as both implement `Summary`). But what if you wanted to force
|
||||
both to have the exact same type? That is only possible if you use a trait
|
||||
bound:
|
||||
|
||||
```rust,ignore
|
||||
pub fn notify<T: Summary>(item1: T, item2: T) {
|
||||
|
|
|
@ -474,7 +474,7 @@ fn foo(string: &str) -> StrWrap<'_> {
|
|||
}
|
||||
```
|
||||
|
||||
The `'_` says “use the elidied lifetime here.” This means that we can still see
|
||||
The `'_` says “use the elided lifetime here.” This means that we can still see
|
||||
that `StrWrap` contains a reference, but we don’t need all of the lifetime
|
||||
annotations to make sense of it.
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ there are multiple functions available named `to_string`. Here, we’re using th
|
|||
library has implemented for any type that implements `Display`.
|
||||
|
||||
Another useful pattern exploits an implementation detail of tuple structs and
|
||||
tuple-struct enum variants. These items use `()` as initialiser syntax, which
|
||||
tuple-struct enum variants. These items use `()` as initializer syntax, which
|
||||
looks like a function call, and they’re actually implemented as functions
|
||||
returning an instance constructed from their arguments. They can also be called
|
||||
as a function pointer implementing the closure traits, and so can be used
|
||||
|
|
Loading…
Reference in New Issue