Skip to content

Remove many instances of 'just' #30766

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 1 commit into from
Jan 11, 2016
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
6 changes: 3 additions & 3 deletions src/doc/book/associated-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn distance<N, E, G: Graph<N, E>>(graph: &G, start: &N, end: &N) -> u32 { ... }
```

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

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

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

From here, we use `=` to define our associated types. The name the trait uses
goes on the left of the `=`, and the concrete type we’re `impl`ementing this
Expand Down
2 changes: 1 addition & 1 deletion src/doc/book/casting-between-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ implemented. For this, we need something more dangerous.
The `transmute` function is provided by a [compiler intrinsic][intrinsics], and
what it does is very simple, but very scary. It tells Rust to treat a value of
one type as though it were another type. It does this regardless of the
typechecking system, and just completely trusts you.
typechecking system, and completely trusts you.

[intrinsics]: intrinsics.html

Expand Down
4 changes: 2 additions & 2 deletions src/doc/book/choosing-your-guarantees.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ These pointers cannot be copied in such a way that they outlive the lifetime ass

## `*const T` and `*mut T`

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

Expand Down Expand Up @@ -255,7 +255,7 @@ major ones will be covered below.

## `Arc<T>`

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

C++'s `shared_ptr` is similar to `Arc`, however in the case of C++ the inner data is always mutable.
Expand Down
6 changes: 3 additions & 3 deletions src/doc/book/closures.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ use it.
# Taking closures as arguments

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

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

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

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

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

Expand Down
4 changes: 2 additions & 2 deletions src/doc/book/concurrency.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,10 @@ fn main() {
}
```

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

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

```rust
Expand Down
8 changes: 4 additions & 4 deletions src/doc/book/crates-and-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ fn hello() -> String {
}
```

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

Expand Down Expand Up @@ -299,7 +299,7 @@ depth.
Rust allows you to precisely control which aspects of your interface are
public, and so private is the default. To make things public, you use the `pub`
keyword. Let’s focus on the `english` module first, so let’s reduce our `src/main.rs`
to just this:
to only this:

```rust,ignore
extern crate phrases;
Expand Down Expand Up @@ -447,7 +447,7 @@ use phrases::english::{greetings, farewells};

## Re-exporting with `pub use`

You don’t just use `use` to shorten identifiers. You can also use it inside of your crate
You don’t only use `use` to shorten identifiers. You can also use it inside of your crate
to re-export a function inside another module. This allows you to present an external
interface that may not directly map to your internal code organization.

Expand Down Expand Up @@ -584,5 +584,5 @@ use sayings::english::farewells as en_farewells;
```

As you can see, the curly brackets compress `use` statements for several items
under the same path, and in this context `self` just refers back to that path.
under the same path, and in this context `self` refers back to that path.
Note: The curly brackets cannot be nested or mixed with star globbing.
4 changes: 2 additions & 2 deletions src/doc/book/custom-allocators.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ own allocator up and running.

The compiler currently ships two default allocators: `alloc_system` and
`alloc_jemalloc` (some targets don't have jemalloc, however). These allocators
are just normal Rust crates and contain an implementation of the routines to
are normal Rust crates and contain an implementation of the routines to
allocate and deallocate memory. The standard library is not compiled assuming
either one, and the compiler will decide which allocator is in use at
compile-time depending on the type of output artifact being produced.
Expand Down Expand Up @@ -134,7 +134,7 @@ pub extern fn __rust_usable_size(size: usize, _align: usize) -> usize {
size
}

# // just needed to get rustdoc to test this
# // only needed to get rustdoc to test this
# fn main() {}
# #[lang = "panic_fmt"] fn panic_fmt() {}
# #[lang = "eh_personality"] fn eh_personality() {}
Expand Down
6 changes: 3 additions & 3 deletions src/doc/book/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ If you want something that's not Rust code, you can add an annotation:
```

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

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

is just
is:

~~~markdown
# Examples
Expand Down
32 changes: 16 additions & 16 deletions src/doc/book/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ the first example. This is because the
panic is embedded in the calls to `unwrap`.

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

Expand Down Expand Up @@ -154,7 +154,7 @@ fn find(haystack: &str, needle: char) -> Option<usize> {
}
```

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

```rust,ignore
fn search<P: AsRef<Path>>
Expand Down Expand Up @@ -2081,7 +2081,7 @@ opts.optflag("q", "quiet", "Silences errors and warnings.");
...
```

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

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

* If you're writing short example code that would be overburdened by error
handling, it's probably just fine to use `unwrap` (whether that's
handling, it's probably fine to use `unwrap` (whether that's
[`Result::unwrap`](../std/result/enum.Result.html#method.unwrap),
[`Option::unwrap`](../std/option/enum.Option.html#method.unwrap)
or preferably
Expand Down
4 changes: 2 additions & 2 deletions src/doc/book/ffi.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ artifact.
A few examples of how this model can be used are:

* A native build dependency. Sometimes some C/C++ glue is needed when writing
some Rust code, but distribution of the C/C++ code in a library format is just
some Rust code, but distribution of the C/C++ code in a library format is
a burden. In this case, the code will be archived into `libfoo.a` and then the
Rust crate would declare a dependency via `#[link(name = "foo", kind =
"static")]`.
Expand Down Expand Up @@ -490,7 +490,7 @@ interoperating with the target's libraries. For example, on win32 with a x86
architecture, this means that the abi used would be `stdcall`. On x86_64,
however, windows uses the `C` calling convention, so `C` would be used. This
means that in our previous example, we could have used `extern "system" { ... }`
to define a block for all windows systems, not just x86 ones.
to define a block for all windows systems, not only x86 ones.

# Interoperability with foreign code

Expand Down
4 changes: 2 additions & 2 deletions src/doc/book/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ statement `x + 1;` doesn’t return a value. There are two kinds of statements i
Rust: ‘declaration statements’ and ‘expression statements’. Everything else is
an expression. Let’s talk about declaration statements first.

In some languages, variable bindings can be written as expressions, not just
In some languages, variable bindings can be written as expressions, not
statements. Like Ruby:

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

```rust
Expand Down
4 changes: 2 additions & 2 deletions src/doc/book/generics.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ let x: Option<f64> = Some(5);
// found `core::option::Option<_>` (expected f64 but found integral variable)
```

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

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

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

```rust
Expand Down
Loading