From efbafdba3618487fbc9305318fcab9775132ac15 Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Sun, 19 Jun 2022 21:06:50 -0400 Subject: [PATCH] Propagate tech review edits to appendices to src --- src/appendix-01-keywords.md | 18 ++++++++++-------- src/appendix-04-useful-development-tools.md | 4 ++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/appendix-01-keywords.md b/src/appendix-01-keywords.md index af1487c6e..b84894591 100644 --- a/src/appendix-01-keywords.md +++ b/src/appendix-01-keywords.md @@ -15,18 +15,17 @@ The following is a list of keywords currently in use, with their functionality described. * `as` - perform primitive casting, disambiguate the specific trait containing - an item, or rename items in `use` and `extern crate` statements + an item, or rename items in `use` statements * `async` - return a `Future` instead of blocking the current thread * `await` - suspend execution until the result of a `Future` is ready * `break` - exit a loop immediately * `const` - define constant items or constant raw pointers * `continue` - continue to the next loop iteration -* `crate` - link an external crate or a macro variable representing the crate in - which the macro is defined +* `crate` - in a module path, refers to the crate root * `dyn` - dynamic dispatch to a trait object * `else` - fallback for `if` and `if let` control flow constructs * `enum` - define an enumeration -* `extern` - link an external crate, function, or variable +* `extern` - link an external function or variable * `false` - Boolean false literal * `fn` - define a function or the function pointer type * `for` - loop over items from an iterator, implement a trait, or specify a @@ -51,7 +50,8 @@ described. * `trait` - define a trait * `true` - Boolean true literal * `type` - define a type alias or associated type -* `union` - define a [union] and is only a keyword when used in a union declaration +* `union` - define a [union][union]; is only a keyword when used + in a union declaration * `unsafe` - denote unsafe code, functions, traits, or implementations * `use` - bring symbols into scope * `where` - denote clauses that constrain a type @@ -124,9 +124,11 @@ This code will compile without any errors. Note the `r#` prefix on the function name in its definition as well as where the function is called in `main`. Raw identifiers allow you to use any word you choose as an identifier, even if -that word happens to be a reserved keyword. In addition, raw identifiers allow -you to use libraries written in a different Rust edition than your crate uses. -For example, `try` isn’t a keyword in the 2015 edition but is in the 2018 +that word happens to be a reserved keyword. This gives us more freedom to +choose identifier names, as well as lets us integrate with programs written in +a language where these words aren’t keywords. In addition, raw identifiers +allow you to use libraries written in a different Rust edition than your crate +uses. For example, `try` isn’t a keyword in the 2015 edition but is in the 2018 edition. If you depend on a library that’s written using the 2015 edition and has a `try` function, you’ll need to use the raw identifier syntax, `r#try` in this case, to call that function from your 2018 edition code. See [Appendix diff --git a/src/appendix-04-useful-development-tools.md b/src/appendix-04-useful-development-tools.md index ffbc0746b..b357f64e2 100644 --- a/src/appendix-04-useful-development-tools.md +++ b/src/appendix-04-useful-development-tools.md @@ -32,8 +32,8 @@ on `rustfmt`, see [its documentation][rustfmt]. ### Fix Your Code with `rustfix` The rustfix tool is included with Rust installations and can automatically fix -compiler warnings that have one way to correct the problem that’s likely what -you want. It’s likely you’ve seen compiler warnings before. For example, +compiler warnings that have a clear way to correct the problem that’s likely +what you want. It’s likely you’ve seen compiler warnings before. For example, consider this code: Filename: src/main.rs