mirror of https://github.com/rust-lang/book
Fancy quotes
This commit is contained in:
parent
8ebd2b4dc0
commit
363216c9c9
|
@ -84,7 +84,7 @@ fn match(needle: &str, haystack: &str) -> bool {
|
|||
}
|
||||
```
|
||||
|
||||
You'll get this error:
|
||||
You’ll get this error:
|
||||
|
||||
```text
|
||||
error: expected identifier, found keyword `match`
|
||||
|
@ -113,5 +113,5 @@ Note the `r#` prefix on both the function name as well as the call.
|
|||
This feature is useful for a few reasons, but the primary motivation was
|
||||
inter-edition situations. For example, `try` is not a keyword in the 2015
|
||||
edition, but is in the 2018 edition. So if you have a library that is written
|
||||
in Rust 2015 and has a `try` function, to call it in Rust 2018, you'll need
|
||||
in Rust 2015 and has a `try` function, to call it in Rust 2018, you’ll need
|
||||
to use the raw identifier.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# D - Useful Development Tools
|
||||
|
||||
In this appendix, we'll talk about tools provided by the Rust project that are
|
||||
In this appendix, we’ll talk about tools provided by the Rust project that are
|
||||
useful when developing Rust code.
|
||||
|
||||
## Automatic Formatting with `rustfmt`
|
||||
|
@ -114,7 +114,7 @@ To install `clippy`:
|
|||
$ rustup component add clippy-preview
|
||||
```
|
||||
|
||||
To take any Cargo project and run clippy's lints on it:
|
||||
To take any Cargo project and run clippy’s lints on it:
|
||||
|
||||
```text
|
||||
$ cargo clippy
|
||||
|
@ -147,7 +147,7 @@ error: approximate value of `f{32, 64}::consts::PI` found. Consider using it dir
|
|||
|
||||
This lets you know that Rust has this constant defined more precisely, and that
|
||||
your program would be more correct if you used the constant instead. This code
|
||||
doesn't result in any errors or warnings from `clippy`:
|
||||
doesn’t result in any errors or warnings from `clippy`:
|
||||
|
||||
<span class="filename">Filename: src/main.rs</span>
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ The Rust language and compiler have a six-week release cycle. This means users
|
|||
get a constant stream of new features. Other programming languages release
|
||||
larger changes less often; Rust chooses to release smaller updates more
|
||||
frequently. After a while, all of those tiny changes add up. But from release
|
||||
to release, it can be hard to look back and say "Wow, between Rust 1.10 and
|
||||
Rust 1.31, Rust has changed a lot!"
|
||||
to release, it can be hard to look back and say “Wow, between Rust 1.10 and
|
||||
Rust 1.31, Rust has changed a lot!”
|
||||
|
||||
Every two or three years, the Rust team produces a new *edition* of Rust.
|
||||
Each edition brings together the features that have landed into a clear
|
||||
|
@ -37,9 +37,9 @@ a new keyword that might conflict with identifiers in code or turning warnings
|
|||
into errors. But unless you opt in to those changes, your code will continue to
|
||||
compile even as you upgrade the version of the Rust compiler that you use. All
|
||||
Rust compiler versions support any edition that existed prior to that
|
||||
compiler's release, and they can link crates of any supported editions
|
||||
compiler’s release, and they can link crates of any supported editions
|
||||
together. Edition changes only affect the way the compiler initially parses
|
||||
code. Therefore, if you're using Rust 2015 and one of your dependencies uses
|
||||
code. Therefore, if you’re using Rust 2015 and one of your dependencies uses
|
||||
Rust 2018, your project will compile and be able to use that dependency. The
|
||||
opposite situation, where your project uses Rust 2018 and a dependency uses
|
||||
Rust 2015, works as well.
|
||||
|
|
|
@ -171,7 +171,7 @@ As such, we’ll provide many examples of code that doesn’t compile along with
|
|||
the error message the compiler will show you in each situation. Know that if
|
||||
you enter and run a random example, it may not compile! Make sure you read the
|
||||
surrounding text to see whether the example you’re trying to run is meant to
|
||||
error. Ferris will also help you distinguish code that isn't meant to work:
|
||||
error. Ferris will also help you distinguish code that isn’t meant to work:
|
||||
|
||||
| Ferris | Meaning |
|
||||
|------------------------------------------------------------------------|--------------------------------------------------|
|
||||
|
|
|
@ -166,7 +166,7 @@ $ ls
|
|||
main main.rs
|
||||
```
|
||||
|
||||
With PowerShell on Windows, you can use `ls` as well, but you'll see three files:
|
||||
With PowerShell on Windows, you can use `ls` as well, but you’ll see three files:
|
||||
|
||||
```text
|
||||
> ls
|
||||
|
|
|
@ -80,7 +80,7 @@ this file, we’ll add other sections.
|
|||
The next four lines set the configuration information Cargo needs to compile
|
||||
your program: the name, the version, and who wrote it. Cargo gets your name and
|
||||
email information from your environment, so if that information is not correct,
|
||||
fix the information now and then save the file. We'll talk about the `edition`
|
||||
fix the information now and then save the file. We’ll talk about the `edition`
|
||||
key in Appendix E.
|
||||
|
||||
The last line, `[dependencies]`, is the start of a section for you to list any
|
||||
|
|
Loading…
Reference in New Issue