Skip to content

Commit f1bb404

Browse files
committed
Fix for a set of typos
1 parent ea72a40 commit f1bb404

File tree

5 files changed

+21
-19
lines changed

5 files changed

+21
-19
lines changed

src/error/iter_result.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Let's step through strategies for handling this.
1717

1818
## Ignore the failed items with `filter_map()`
1919

20-
`filter_map` calls a function and filters out the results that are `None`.
20+
`filter_map` calls a function and filters out the results that are `Err`.
2121

2222
```rust,editable
2323
fn main() {

src/generics/phantom.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A phantom type parameter is one that doesn't show up at runtime,
44
but is checked statically (and only) at compile time.
55

66
Data types can use extra generic type parameters to act as markers
7-
or to perform type checking at compile time. These extra parameters
7+
or to perform type checking at compile time. These extra parameters
88
hold no storage values, and have no runtime behavior.
99

1010
In the following example, we combine [std::marker::PhantomData]
@@ -16,7 +16,7 @@ use std::marker::PhantomData;
1616
1717
// A phantom tuple struct which is generic over `A` with hidden parameter `B`.
1818
#[derive(PartialEq)] // Allow equality test for this type.
19-
struct PhantomTuple<A, B>(A,PhantomData<B>);
19+
struct PhantomTuple<A, B>(A, PhantomData<B>);
2020
2121
// A phantom type struct which is generic over `A` with hidden parameter `B`.
2222
#[derive(PartialEq)] // Allow equality test for this type.
@@ -42,14 +42,14 @@ fn main() {
4242
first: 'Q',
4343
phantom: PhantomData,
4444
};
45-
45+
4646
// Compile-time Error! Type mismatch so these cannot be compared:
47-
//println!("_tuple1 == _tuple2 yields: {}",
48-
// _tuple1 == _tuple2);
49-
47+
// println!("_tuple1 == _tuple2 yields: {}",
48+
// _tuple1 == _tuple2);
49+
5050
// Compile-time Error! Type mismatch so these cannot be compared:
51-
//println!("_struct1 == _struct2 yields: {}",
52-
// _struct1 == _struct2);
51+
// println!("_struct1 == _struct2 yields: {}",
52+
// _struct1 == _struct2);
5353
}
5454
```
5555

@@ -60,4 +60,4 @@ fn main() {
6060
[Derive]: ../trait/derive.md
6161
[struct]: ../custom_types/structs.md
6262
[TupleStructs]: ../custom_types/structs.md
63-
[std::marker::PhantomData]: https://doc.rust-lang.org/std/marker/struct.PhantomData.html
63+
[std::marker::PhantomData]: https://doc.rust-lang.org/std/marker/struct.PhantomData.html

src/hello/print.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ some of which include:
77
* `print!`: same as `format!` but the text is printed to the console (io::stdout).
88
* `println!`: same as `print!` but a newline is appended.
99
* `eprint!`: same as `print!` but the text is printed to the standard error (io::stderr).
10-
* `eprintln!`: same as `eprint!`but a newline is appended.
10+
* `eprintln!`: same as `eprint!` but a newline is appended.
1111

1212
All parse text in the same fashion. As a plus, Rust checks formatting
1313
correctness at compile time.

src/primitives/array.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ at compile time, is part of their type signature `[T; length]`.
66

77
Slices are similar to arrays, but their length is not known at compile time.
88
Instead, a slice is a two-word object, the first word is a pointer to the data,
9-
and the second word is the length of the slice. The word size is the same as
10-
usize, determined by the processor architecture eg 64 bits on an x86-64.
11-
Slices can be used to borrow a section of an array, and have the type signature
9+
and the second word is the length of the slice. The word size is the same as
10+
usize, determined by the processor architecture e.g. 64 bits on an x86-64.
11+
Slices can be used to borrow a section of an array, and have the type signature
1212
`&[T]`.
1313

1414
```rust,editable,ignore,mdbook-runnable

src/trait/disambiguating.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Disambiguating overlapping traits
22

3-
A type can implement many different traits. What if two traits both require the same name? For example, many traits might have a method named `get()`. They might even have different return types!
3+
A type can implement many different traits. What if two traits both require
4+
the same name? For example, many traits might have a method named `get()`.
5+
They might even have different return types!
46

5-
Good news: because each trait implementation gets its own `impl` block, it's
6-
clear which trait's `get` method you're implementing.
7+
Good news: because each trait implementation gets its own `impl` block, it's
8+
clear which trait's `get` method you're implementing.
79

810
What about when it comes time to _call_ those methods? To disambiguate between
911
them, we have to use Fully Qualified Syntax.
@@ -38,12 +40,12 @@ impl AgeWidget for Form {
3840
}
3941
4042
fn main() {
41-
let form = Form{
43+
let form = Form {
4244
username: "rustacean".to_owned(),
4345
age: 28,
4446
};
4547
46-
// If you uncomment this line, you'll get an error saying
48+
// If you uncomment this line, you'll get an error saying
4749
// "multiple `get` found". Because, after all, there are multiple methods
4850
// named `get`.
4951
// println!("{}", form.get());

0 commit comments

Comments
 (0)