Skip to content

Commit 0672ed4

Browse files
committed
Auto merge of #30800 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #30766, #30771, #30789 - Failed merges:
2 parents d01ed8a + b2e670a commit 0672ed4

34 files changed

+107
-108
lines changed

src/doc/book/associated-types.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn distance<N, E, G: Graph<N, E>>(graph: &G, start: &N, end: &N) -> u32 { ... }
2424
```
2525

2626
Our distance calculation works regardless of our `Edge` type, so the `E` stuff in
27-
this signature is just a distraction.
27+
this signature is a distraction.
2828

2929
What we really want to say is that a certain `E`dge and `N`ode type come together
3030
to form each kind of `Graph`. We can do that with associated types:
@@ -118,10 +118,10 @@ impl Graph for MyGraph {
118118
This silly implementation always returns `true` and an empty `Vec<Edge>`, but it
119119
gives you an idea of how to implement this kind of thing. We first need three
120120
`struct`s, one for the graph, one for the node, and one for the edge. If it made
121-
more sense to use a different type, that would work as well, we’re just going to
121+
more sense to use a different type, that would work as well, we’re going to
122122
use `struct`s for all three here.
123123

124-
Next is the `impl` line, which is just like implementing any other trait.
124+
Next is the `impl` line, which is an implementation like any other trait.
125125

126126
From here, we use `=` to define our associated types. The name the trait uses
127127
goes on the left of the `=`, and the concrete type we’re `impl`ementing this

src/doc/book/casting-between-types.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ implemented. For this, we need something more dangerous.
154154
The `transmute` function is provided by a [compiler intrinsic][intrinsics], and
155155
what it does is very simple, but very scary. It tells Rust to treat a value of
156156
one type as though it were another type. It does this regardless of the
157-
typechecking system, and just completely trusts you.
157+
typechecking system, and completely trusts you.
158158

159159
[intrinsics]: intrinsics.html
160160

src/doc/book/choosing-your-guarantees.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ These pointers cannot be copied in such a way that they outlive the lifetime ass
5252

5353
## `*const T` and `*mut T`
5454

55-
These are C-like raw pointers with no lifetime or ownership attached to them. They just point to
55+
These are C-like raw pointers with no lifetime or ownership attached to them. They point to
5656
some location in memory with no other restrictions. The only guarantee that these provide is that
5757
they cannot be dereferenced except in code marked `unsafe`.
5858

@@ -255,7 +255,7 @@ major ones will be covered below.
255255

256256
## `Arc<T>`
257257

258-
[`Arc<T>`][arc] is just a version of `Rc<T>` that uses an atomic reference count (hence, "Arc").
258+
[`Arc<T>`][arc] is a version of `Rc<T>` that uses an atomic reference count (hence, "Arc").
259259
This can be sent freely between threads.
260260

261261
C++'s `shared_ptr` is similar to `Arc`, however in the case of C++ the inner data is always mutable.

src/doc/book/closures.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ use it.
253253
# Taking closures as arguments
254254

255255
Now that we know that closures are traits, we already know how to accept and
256-
return closures: just like any other trait!
256+
return closures: the same as any other trait!
257257

258258
This also means that we can choose static vs dynamic dispatch as well. First,
259259
let’s write a function which takes something callable, calls it, and returns
@@ -271,7 +271,7 @@ let answer = call_with_one(|x| x + 2);
271271
assert_eq!(3, answer);
272272
```
273273

274-
We pass our closure, `|x| x + 2`, to `call_with_one`. It just does what it
274+
We pass our closure, `|x| x + 2`, to `call_with_one`. It does what it
275275
suggests: it calls the closure, giving it `1` as an argument.
276276

277277
Let’s examine the signature of `call_with_one` in more depth:
@@ -448,7 +448,7 @@ This error is letting us know that we don’t have a `&'static Fn(i32) -> i32`,
448448
we have a `[closure@<anon>:7:9: 7:20]`. Wait, what?
449449

450450
Because each closure generates its own environment `struct` and implementation
451-
of `Fn` and friends, these types are anonymous. They exist just solely for
451+
of `Fn` and friends, these types are anonymous. They exist solely for
452452
this closure. So Rust shows them as `closure@<anon>`, rather than some
453453
autogenerated name.
454454

src/doc/book/concurrency.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,10 @@ fn main() {
305305
}
306306
```
307307

308-
We use the `mpsc::channel()` method to construct a new channel. We just `send`
308+
We use the `mpsc::channel()` method to construct a new channel. We `send`
309309
a simple `()` down the channel, and then wait for ten of them to come back.
310310

311-
While this channel is just sending a generic signal, we can send any data that
311+
While this channel is sending a generic signal, we can send any data that
312312
is `Send` over the channel!
313313

314314
```rust

src/doc/book/crates-and-modules.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ fn hello() -> String {
222222
}
223223
```
224224

225-
Of course, you can copy and paste this from this web page, or just type
225+
Of course, you can copy and paste this from this web page, or type
226226
something else. It’s not important that you actually put ‘konnichiwa’ to learn
227227
about the module system.
228228

@@ -299,7 +299,7 @@ depth.
299299
Rust allows you to precisely control which aspects of your interface are
300300
public, and so private is the default. To make things public, you use the `pub`
301301
keyword. Let’s focus on the `english` module first, so let’s reduce our `src/main.rs`
302-
to just this:
302+
to only this:
303303
304304
```rust,ignore
305305
extern crate phrases;
@@ -447,7 +447,7 @@ use phrases::english::{greetings, farewells};
447447
448448
## Re-exporting with `pub use`
449449
450-
You don’t just use `use` to shorten identifiers. You can also use it inside of your crate
450+
You don’t only use `use` to shorten identifiers. You can also use it inside of your crate
451451
to re-export a function inside another module. This allows you to present an external
452452
interface that may not directly map to your internal code organization.
453453
@@ -584,5 +584,5 @@ use sayings::english::farewells as en_farewells;
584584
```
585585
586586
As you can see, the curly brackets compress `use` statements for several items
587-
under the same path, and in this context `self` just refers back to that path.
587+
under the same path, and in this context `self` refers back to that path.
588588
Note: The curly brackets cannot be nested or mixed with star globbing.

src/doc/book/custom-allocators.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ own allocator up and running.
1313

1414
The compiler currently ships two default allocators: `alloc_system` and
1515
`alloc_jemalloc` (some targets don't have jemalloc, however). These allocators
16-
are just normal Rust crates and contain an implementation of the routines to
16+
are normal Rust crates and contain an implementation of the routines to
1717
allocate and deallocate memory. The standard library is not compiled assuming
1818
either one, and the compiler will decide which allocator is in use at
1919
compile-time depending on the type of output artifact being produced.
@@ -134,7 +134,7 @@ pub extern fn __rust_usable_size(size: usize, _align: usize) -> usize {
134134
size
135135
}
136136
137-
# // just needed to get rustdoc to test this
137+
# // only needed to get rustdoc to test this
138138
# fn main() {}
139139
# #[lang = "panic_fmt"] fn panic_fmt() {}
140140
# #[lang = "eh_personality"] fn eh_personality() {}

src/doc/book/documentation.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ If you want something that's not Rust code, you can add an annotation:
193193
```
194194

195195
This will highlight according to whatever language you're showing off.
196-
If you're just showing plain text, choose `text`.
196+
If you're only showing plain text, choose `text`.
197197

198198
It's important to choose the correct annotation here, because `rustdoc` uses it
199199
in an interesting way: It can be used to actually test your examples in a
@@ -273,7 +273,7 @@ be hidden from the output, but will be used when compiling your code. You
273273
can use this to your advantage. In this case, documentation comments need
274274
to apply to some kind of function, so if I want to show you just a
275275
documentation comment, I need to add a little function definition below
276-
it. At the same time, it's just there to satisfy the compiler, so hiding
276+
it. At the same time, it's only there to satisfy the compiler, so hiding
277277
it makes the example more clear. You can use this technique to explain
278278
longer examples in detail, while still preserving the testability of your
279279
documentation.
@@ -512,7 +512,7 @@ the documentation with comments. For example:
512512
# fn foo() {}
513513
```
514514

515-
is just
515+
is:
516516

517517
~~~markdown
518518
# Examples

src/doc/book/enums.md

-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ learn in the next section. We don’t know enough about Rust to implement
6262
equality yet, but we’ll find out in the [`traits`][traits] section.
6363

6464
[match]: match.html
65-
[if-let]: if-let.html
6665
[traits]: traits.html
6766

6867
# Constructors as functions

src/doc/book/error-handling.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ the first example. This is because the
117117
panic is embedded in the calls to `unwrap`.
118118

119119
To “unwrap” something in Rust is to say, “Give me the result of the
120-
computation, and if there was an error, just panic and stop the program.”
121-
It would be better if we just showed the code for unwrapping because it is so
120+
computation, and if there was an error, panic and stop the program.”
121+
It would be better if we showed the code for unwrapping because it is so
122122
simple, but to do that, we will first need to explore the `Option` and `Result`
123123
types. Both of these types have a method called `unwrap` defined on them.
124124

@@ -154,7 +154,7 @@ fn find(haystack: &str, needle: char) -> Option<usize> {
154154
}
155155
```
156156

157-
Notice that when this function finds a matching character, it doesn't just
157+
Notice that when this function finds a matching character, it doesn't only
158158
return the `offset`. Instead, it returns `Some(offset)`. `Some` is a variant or
159159
a *value constructor* for the `Option` type. You can think of it as a function
160160
with the type `fn<T>(value: T) -> Option<T>`. Correspondingly, `None` is also a
@@ -216,7 +216,7 @@ we saw how to use `find` to discover the extension in a file name. Of course,
216216
not all file names have a `.` in them, so it's possible that the file name has
217217
no extension. This *possibility of absence* is encoded into the types using
218218
`Option<T>`. In other words, the compiler will force us to address the
219-
possibility that an extension does not exist. In our case, we just print out a
219+
possibility that an extension does not exist. In our case, we only print out a
220220
message saying as such.
221221

222222
Getting the extension of a file name is a pretty common operation, so it makes
@@ -248,7 +248,7 @@ tiresome.
248248

249249
In fact, the case analysis in `extension_explicit` follows a very common
250250
pattern: *map* a function on to the value inside of an `Option<T>`, unless the
251-
option is `None`, in which case, just return `None`.
251+
option is `None`, in which case, return `None`.
252252

253253
Rust has parametric polymorphism, so it is very easy to define a combinator
254254
that abstracts this pattern:
@@ -350,7 +350,7 @@ fn file_name(file_path: &str) -> Option<&str> {
350350
}
351351
```
352352

353-
You might think that we could just use the `map` combinator to reduce the case
353+
You might think that we could use the `map` combinator to reduce the case
354354
analysis, but its type doesn't quite fit. Namely, `map` takes a function that
355355
does something only with the inner value. The result of that function is then
356356
*always* [rewrapped with `Some`](#code-option-map). Instead, we need something
@@ -670,7 +670,7 @@ The tricky aspect here is that `argv.nth(1)` produces an `Option` while
670670
with both an `Option` and a `Result`, the solution is *usually* to convert the
671671
`Option` to a `Result`. In our case, the absence of a command line parameter
672672
(from `env::args()`) means the user didn't invoke the program correctly. We
673-
could just use a `String` to describe the error. Let's try:
673+
could use a `String` to describe the error. Let's try:
674674

675675
<span id="code-error-double-string"></span>
676676

@@ -709,7 +709,7 @@ fn ok_or<T, E>(option: Option<T>, err: E) -> Result<T, E> {
709709

710710
The other new combinator used here is
711711
[`Result::map_err`](../std/result/enum.Result.html#method.map_err).
712-
This is just like `Result::map`, except it maps a function on to the *error*
712+
This is like `Result::map`, except it maps a function on to the *error*
713713
portion of a `Result` value. If the `Result` is an `Ok(...)` value, then it is
714714
returned unmodified.
715715

@@ -841,7 +841,7 @@ example, the very last call to `map` multiplies the `Ok(...)` value (which is
841841
an `i32`) by `2`. If an error had occurred before that point, this operation
842842
would have been skipped because of how `map` is defined.
843843

844-
`map_err` is the trick that makes all of this work. `map_err` is just like
844+
`map_err` is the trick that makes all of this work. `map_err` is like
845845
`map`, except it applies a function to the `Err(...)` value of a `Result`. In
846846
this case, we want to convert all of our errors to one type: `String`. Since
847847
both `io::Error` and `num::ParseIntError` implement `ToString`, we can call the
@@ -901,7 +901,7 @@ reduce explicit case analysis. Combinators aren't the only way.
901901
## The `try!` macro
902902

903903
A cornerstone of error handling in Rust is the `try!` macro. The `try!` macro
904-
abstracts case analysis just like combinators, but unlike combinators, it also
904+
abstracts case analysis like combinators, but unlike combinators, it also
905905
abstracts *control flow*. Namely, it can abstract the *early return* pattern
906906
seen above.
907907

@@ -1461,7 +1461,7 @@ expose its representation (like
14611461
[`ErrorKind`](../std/io/enum.ErrorKind.html)) or keep it hidden (like
14621462
[`ParseIntError`](../std/num/struct.ParseIntError.html)). Regardless
14631463
of how you do it, it's usually good practice to at least provide some
1464-
information about the error beyond just its `String`
1464+
information about the error beyond its `String`
14651465
representation. But certainly, this will vary depending on use cases.
14661466

14671467
At a minimum, you should probably implement the
@@ -1499,7 +1499,7 @@ that can go wrong!
14991499
The data we'll be using comes from the [Data Science
15001500
Toolkit][11]. I've prepared some data from it for this exercise. You
15011501
can either grab the [world population data][12] (41MB gzip compressed,
1502-
145MB uncompressed) or just the [US population data][13] (2.2MB gzip
1502+
145MB uncompressed) or only the [US population data][13] (2.2MB gzip
15031503
compressed, 7.2MB uncompressed).
15041504

15051505
Up until now, we've kept the code limited to Rust's standard library. For a real
@@ -1706,7 +1706,7 @@ compiler can no longer reason about its underlying type.
17061706

17071707
[Previously](#the-limits-of-combinators) we started refactoring our code by
17081708
changing the type of our function from `T` to `Result<T, OurErrorType>`. In
1709-
this case, `OurErrorType` is just `Box<Error>`. But what's `T`? And can we add
1709+
this case, `OurErrorType` is only `Box<Error>`. But what's `T`? And can we add
17101710
a return type to `main`?
17111711

17121712
The answer to the second question is no, we can't. That means we'll need to
@@ -1924,7 +1924,7 @@ parser out of
19241924
But how can we use the same code over both types? There's actually a
19251925
couple ways we could go about this. One way is to write `search` such
19261926
that it is generic on some type parameter `R` that satisfies
1927-
`io::Read`. Another way is to just use trait objects:
1927+
`io::Read`. Another way is to use trait objects:
19281928

19291929
```rust,ignore
19301930
fn search<P: AsRef<Path>>
@@ -2081,7 +2081,7 @@ opts.optflag("q", "quiet", "Silences errors and warnings.");
20812081
...
20822082
```
20832083

2084-
Now we just need to implement our “quiet” functionality. This requires us to
2084+
Now we only need to implement our “quiet” functionality. This requires us to
20852085
tweak the case analysis in `main`:
20862086

20872087
```rust,ignore
@@ -2114,7 +2114,7 @@ handling in Rust. These are some good “rules of thumb." They are emphatically
21142114
heuristics!
21152115

21162116
* If you're writing short example code that would be overburdened by error
2117-
handling, it's probably just fine to use `unwrap` (whether that's
2117+
handling, it's probably fine to use `unwrap` (whether that's
21182118
[`Result::unwrap`](../std/result/enum.Result.html#method.unwrap),
21192119
[`Option::unwrap`](../std/option/enum.Option.html#method.unwrap)
21202120
or preferably

src/doc/book/ffi.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ artifact.
367367
A few examples of how this model can be used are:
368368
369369
* A native build dependency. Sometimes some C/C++ glue is needed when writing
370-
some Rust code, but distribution of the C/C++ code in a library format is just
370+
some Rust code, but distribution of the C/C++ code in a library format is
371371
a burden. In this case, the code will be archived into `libfoo.a` and then the
372372
Rust crate would declare a dependency via `#[link(name = "foo", kind =
373373
"static")]`.
@@ -490,7 +490,7 @@ interoperating with the target's libraries. For example, on win32 with a x86
490490
architecture, this means that the abi used would be `stdcall`. On x86_64,
491491
however, windows uses the `C` calling convention, so `C` would be used. This
492492
means that in our previous example, we could have used `extern "system" { ... }`
493-
to define a block for all windows systems, not just x86 ones.
493+
to define a block for all windows systems, not only x86 ones.
494494

495495
# Interoperability with foreign code
496496

src/doc/book/functions.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ statement `x + 1;` doesn’t return a value. There are two kinds of statements i
124124
Rust: ‘declaration statements’ and ‘expression statements’. Everything else is
125125
an expression. Let’s talk about declaration statements first.
126126

127-
In some languages, variable bindings can be written as expressions, not just
127+
In some languages, variable bindings can be written as expressions, not
128128
statements. Like Ruby:
129129

130130
```ruby
@@ -145,7 +145,7 @@ Note that assigning to an already-bound variable (e.g. `y = 5`) is still an
145145
expression, although its value is not particularly useful. Unlike other
146146
languages where an assignment evaluates to the assigned value (e.g. `5` in the
147147
previous example), in Rust the value of an assignment is an empty tuple `()`
148-
because the assigned value can have [just one owner](ownership.html), and any
148+
because the assigned value can have [only one owner](ownership.html), and any
149149
other returned value would be too surprising:
150150

151151
```rust

src/doc/book/generics.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ let x: Option<f64> = Some(5);
3737
// found `core::option::Option<_>` (expected f64 but found integral variable)
3838
```
3939

40-
That doesn’t mean we can’t make `Option<T>`s that hold an `f64`! They just have
40+
That doesn’t mean we can’t make `Option<T>`s that hold an `f64`! They have
4141
to match up:
4242

4343
```rust
@@ -118,7 +118,7 @@ let float_origin = Point { x: 0.0, y: 0.0 };
118118
Similar to functions, the `<T>` is where we declare the generic parameters,
119119
and we then use `x: T` in the type declaration, too.
120120

121-
When you want to add an implementation for the generic `struct`, you just
121+
When you want to add an implementation for the generic `struct`, you
122122
declare the type parameter after the `impl`:
123123

124124
```rust

0 commit comments

Comments
 (0)