diff --git a/src/editions/transitioning-an-existing-project-to-a-new-edition.md b/src/editions/transitioning-an-existing-project-to-a-new-edition.md index 45b6d102..161b742d 100644 --- a/src/editions/transitioning-an-existing-project-to-a-new-edition.md +++ b/src/editions/transitioning-an-existing-project-to-a-new-edition.md @@ -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 diff --git a/src/rust-2018/cargo-and-crates-io/cargo-check-for-faster-checking.md b/src/rust-2018/cargo-and-crates-io/cargo-check-for-faster-checking.md index 323297d8..46166583 100644 --- a/src/rust-2018/cargo-and-crates-io/cargo-check-for-faster-checking.md +++ b/src/rust-2018/cargo-and-crates-io/cargo-check-for-faster-checking.md @@ -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 diff --git a/src/rust-2018/cargo-and-crates-io/cargo-new-defaults-to-a-binary-project.md b/src/rust-2018/cargo-and-crates-io/cargo-new-defaults-to-a-binary-project.md index 5e12c0b0..96198aba 100644 --- a/src/rust-2018/cargo-and-crates-io/cargo-new-defaults-to-a-binary-project.md +++ b/src/rust-2018/cargo-and-crates-io/cargo-new-defaults-to-a-binary-project.md @@ -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 diff --git a/src/rust-2018/cargo-and-crates-io/cargo-rustc-for-passing-arbitrary-flags-to-rustc.md b/src/rust-2018/cargo-and-crates-io/cargo-rustc-for-passing-arbitrary-flags-to-rustc.md index 8a13e004..cd419646 100644 --- a/src/rust-2018/cargo-and-crates-io/cargo-rustc-for-passing-arbitrary-flags-to-rustc.md +++ b/src/rust-2018/cargo-and-crates-io/cargo-rustc-for-passing-arbitrary-flags-to-rustc.md @@ -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 diff --git a/src/rust-2018/cargo-and-crates-io/index.md b/src/rust-2018/cargo-and-crates-io/index.md index 46e01450..2608e338 100644 --- a/src/rust-2018/cargo-and-crates-io/index.md +++ b/src/rust-2018/cargo-and-crates-io/index.md @@ -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. diff --git a/src/rust-2018/control-flow/loops-can-break-with-a-value.md b/src/rust-2018/control-flow/loops-can-break-with-a-value.md index b76a75fe..c3099981 100644 --- a/src/rust-2018/control-flow/loops-can-break-with-a-value.md +++ b/src/rust-2018/control-flow/loops-can-break-with-a-value.md @@ -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. \ No newline at end of file +See the rationale for this decision in RFC issue [#1767](https://github.com/rust-lang/rfcs/issues/1767). diff --git a/src/rust-2018/data-types/inclusive-ranges.md b/src/rust-2018/data-types/inclusive-ranges.md index ab27c34f..ee460caa 100644 --- a/src/rust-2018/data-types/inclusive-ranges.md +++ b/src/rust-2018/data-types/inclusive-ranges.md @@ -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 { diff --git a/src/rust-2018/module-system/path-clarity.md b/src/rust-2018/module-system/path-clarity.md index 37c978e0..e4522c78 100644 --- a/src/rust-2018/module-system/path-clarity.md +++ b/src/rust-2018/module-system/path-clarity.md @@ -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 @@ -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 diff --git a/src/rust-2018/the-compiler/incremental-compilation-for-faster-compiles.md b/src/rust-2018/the-compiler/incremental-compilation-for-faster-compiles.md index 6e7ebf8a..8ce7a3c9 100644 --- a/src/rust-2018/the-compiler/incremental-compilation-for-faster-compiles.md +++ b/src/rust-2018/the-compiler/incremental-compilation-for-faster-compiles.md @@ -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 diff --git a/src/rust-2018/trait-system/dyn-trait-for-trait-objects.md b/src/rust-2018/trait-system/dyn-trait-for-trait-objects.md index daab45be..d6e62a26 100644 --- a/src/rust-2018/trait-system/dyn-trait-for-trait-objects.md +++ b/src/rust-2018/trait-system/dyn-trait-for-trait-objects.md @@ -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. \ No newline at end of file diff --git a/src/rust-2018/trait-system/impl-trait-for-returning-complex-types-with-ease.md b/src/rust-2018/trait-system/impl-trait-for-returning-complex-types-with-ease.md index 190b04e5..87efbfe7 100644 --- a/src/rust-2018/trait-system/impl-trait-for-returning-complex-types-with-ease.md +++ b/src/rust-2018/trait-system/impl-trait-for-returning-complex-types-with-ease.md @@ -124,7 +124,7 @@ fn foo(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: @@ -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 If you haven't seen the `dyn` syntax before, see the section on it. For -> versions that do not support it, replace `Rc` with `Rc`. +> 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` +> with `Rc`.