Skip to content

Commit

Permalink
update original
Browse files Browse the repository at this point in the history
  • Loading branch information
funkill committed Jan 14, 2025
1 parent 42eff3e commit e606a2e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion rustbook-en/packages/mdbook-trpl/src/listing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ impl Listing {
fn opening_text(&self) -> String {
self.file_name
.as_ref()
.map(|file_name| format!("Filename: {file_name}\n"))
.map(|file_name| format!("{file_name}\n"))
.unwrap_or_default()
}

Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/packages/mdbook-trpl/src/listing/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Trailing text."#,
&result.unwrap(),
r#"Leading text.
Filename: src/main.rs
src/main.rs
```rust
fn main() {}
Expand Down
21 changes: 12 additions & 9 deletions rustbook-en/src/appendix-01-keywords.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ Rust for potential future use.
- `box`
- `do`
- `final`

* `gen`

- `macro`
- `override`
- `priv`
Expand Down Expand Up @@ -124,14 +127,14 @@ 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. 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
E][appendix-e]<!-- ignore --> for more information on editions.
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, 2021,
and 2024 editions. 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 E][appendix-e]<!-- ignore --> for more information on editions.

[appendix-e]: appendix-05-editions.html

0 comments on commit e606a2e

Please sign in to comment.