Skip to content
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

Small fixes #179

Merged
merged 14 commits into from
Jun 14, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ It's re-written our code to introduce a parameter name for that trait object.
In this case, since it had no name, `cargo fix` will replace it with `_`,
which is conventional for unused variables.

`cargo fix` is still pretty new, and so it can't always fix your code automatically.
`cargo fix` can't always fix your code automatically.
If `cargo fix` can't fix something, it will print the warning that it cannot fix
to the console. If you see one of these warnings, you'll have to update your code
manually. See the corresponding section of this guide for help, and if you have
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![Minimum Rust version: 1.16](https://img.shields.io/badge/Minimum%20Rust%20Version-1.16-brightgreen.svg)

`cargo check` is a new subcommand should speed up the development
`cargo check` is a new subcommand that should speed up the development
workflow in many cases.

What does it do? Let's take a step back and talk about how `rustc` compiles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
We try to keep Cargo’s CLI quite stable, but this change is important, and is
unlikely to cause breakage.

For some background, cargo new accepts two flags: `--lib`, for creating
For some background, `cargo new` accepts two flags: `--lib`, for creating
libraries, and `--bin`, for creating binaries, or executables. If you don’t
pass one of these flags, it used to default to `--lib`. At the time, we made
this decision because each binary (often) depends on many libraries, and so
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

For example, Cargo does not have a way to pass unstable flags built-in. But
if we'd like to use `print-type-sizes` to see what layout information our
types have. We can run this:
types have, we can run this:

```console
$ cargo rustc -- -Z print-type-sizes
Expand Down
3 changes: 2 additions & 1 deletion src/rust-2018/cargo-and-crates-io/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Cargo and crates.io

[check]: cargo-check-for-faster-checking.md
[cratesio]: https://crates.io

In this chapter of the guide, we discuss a few improvements to `cargo` and crates.io.
In this chapter of the guide, we discuss a few improvements to `cargo` and [crates.io][cratesio].
A notable addition here is the new [`cargo check`][check] command.
2 changes: 1 addition & 1 deletion src/rust-2018/control-flow/loops-can-break-with-a-value.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ rather than statements. `loop` stuck out as strange in this way, as it was
previously a statement.

For now, this only applies to `loop`, and not things like `while` or `for`.
It's not clear yet, but we may add this to those in the future.
See the rationale for this decision in RFC issue [#1767](https://github.com/rust-lang/rfcs/issues/1767).
2 changes: 1 addition & 1 deletion src/rust-2018/data-types/inclusive-ranges.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
![Minimum Rust version: 1.26](https://img.shields.io/badge/Minimum%20Rust%20Version-1.26-brightgreen.svg)

Since well before Rust 1.0, you’ve been able to create exclusive ranges with
.. like this:
`..` like this:

```
for i in 1..3 {
Expand Down
4 changes: 3 additions & 1 deletion src/rust-2018/module-system/path-clarity.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ Finally, on nightly, you'll need it for crates like:
One other use for `extern crate` was to import macros; that's no longer needed.
Check [the macro section](../macros/macro-changes.md) for more.

#### Renaming crates

If you've been using `as` to rename your crate like this:

```rust,ignore
Expand All @@ -109,7 +111,7 @@ use self::f::Future;

This change will need to happen in any module that uses `f`.

### The `crate` keyword refers to the current crate.
### The `crate` keyword refers to the current crate

In `use` declarations and in other code, you can refer to the root of the
current crate with the `crate::` prefix. For instance, `crate::foo::bar` will
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ compilation is that you only need to compile the code you’ve actually
changed, which means that that second build is faster.

This is now turned on by default. This means that your builds should be
faster! Don’t forget about cargo check when trying to get the lowest possible
faster! Don’t forget about `cargo check` when trying to get the lowest possible
build times.

This is still not the end story for compiler performance generally, nor
Expand Down
2 changes: 1 addition & 1 deletion src/rust-2018/trait-system/dyn-trait-for-trait-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ is sometimes slower, and often cannot be used at all when its alternatives can.

Furthermore, with `impl Trait` arriving, "`impl Trait` vs `dyn Trait`" is much
more symmetric, and therefore a bit nicer, than "`impl Trait` vs `Trait`".
`impl Trait` is explained [here](impl-trait-for-returning-complex-types-with-ease.md)
`impl Trait` is explained [here](impl-trait-for-returning-complex-types-with-ease.md).

In the new edition, you should therefore prefer `dyn Trait` to just `Trait`
where you need a trait object.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ fn foo<T: Trait>(x: T) {
```

When you call it, you set the type, `T`. "you" being the caller here. This
signature says "I accept any type that implements Trait." ("any type" ==
signature says "I accept any type that implements `Trait`." ("any type" ==
universal in the jargon)

This version:
Expand Down Expand Up @@ -154,7 +154,7 @@ type... anyway, you can see how `F` is in the return position here. So you
have the ability to choose.

With `impl Trait`, you're saying "hey, some type exists that implements this
trait, but I'm not gonna tell you what it is.". So now, the caller can't
trait, but I'm not gonna tell you what it is." So now, the caller can't
choose, and the function itself gets to choose. If we tried to define parse
with `Result<impl F,...` as the return type, it wouldn't work.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ fn main() {

This code would not work with Rust 1.0, but now works.

> If you haven't seen the `dyn` syntax before, see the section on it. For
> versions that do not support it, replace `Rc<dyn Foo>` with `Rc<Foo>`.
> If you haven't seen the `dyn` syntax before, see [the section on
> it](dyn-trait-for-trait-objects.md). For versions that do not support it, replace `Rc<dyn Foo>`
> with `Rc<Foo>`.