From 9835e2ae736235810b4ea1c162ca5e65c547e770 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 18 May 2024 04:49:50 +0200 Subject: Merging upstream version 1.71.1+dfsg1. Signed-off-by: Daniel Baumann --- src/doc/rust-by-example/README.md | 10 +++++----- .../src/error/multiple_error_types/reenter_question_mark.md | 2 +- src/doc/rust-by-example/src/hello/print.md | 5 +++-- src/doc/rust-by-example/src/primitives/array.md | 4 +++- 4 files changed, 12 insertions(+), 9 deletions(-) (limited to 'src/doc/rust-by-example') diff --git a/src/doc/rust-by-example/README.md b/src/doc/rust-by-example/README.md index 462f733e5..e43b044c8 100644 --- a/src/doc/rust-by-example/README.md +++ b/src/doc/rust-by-example/README.md @@ -15,11 +15,11 @@ to read it online. If you'd like to read it locally, [install Rust], and then: ```bash -$ git clone https://github.com/rust-lang/rust-by-example -$ cd rust-by-example -$ cargo install mdbook -$ mdbook build -$ mdbook serve +git clone https://github.com/rust-lang/rust-by-example +cd rust-by-example +cargo install mdbook +mdbook build +mdbook serve ``` [install Rust]: https://www.rust-lang.org/tools/install diff --git a/src/doc/rust-by-example/src/error/multiple_error_types/reenter_question_mark.md b/src/doc/rust-by-example/src/error/multiple_error_types/reenter_question_mark.md index 61f80fc3e..998b741e7 100644 --- a/src/doc/rust-by-example/src/error/multiple_error_types/reenter_question_mark.md +++ b/src/doc/rust-by-example/src/error/multiple_error_types/reenter_question_mark.md @@ -5,7 +5,7 @@ Notice in the previous example that our immediate reaction to calling error: ```rust,ignore -.and_then(|s| s.parse::() +.and_then(|s| s.parse::()) .map_err(|e| e.into()) ``` diff --git a/src/doc/rust-by-example/src/hello/print.md b/src/doc/rust-by-example/src/hello/print.md index d578337ad..bf23a9023 100644 --- a/src/doc/rust-by-example/src/hello/print.md +++ b/src/doc/rust-by-example/src/hello/print.md @@ -44,8 +44,9 @@ fn main() { println!("{number:>5}", number=1); // You can pad numbers with extra zeroes, + println!("{number:0>5}", number=1); // 00001 // and left-adjust by flipping the sign. This will output "10000". - println!("{number:0<5}", number=1); + println!("{number:0<5}", number=1); // 10000 // You can use named arguments in the format specifier by appending a `$`. println!("{number:0>width$}", number=1, width=5); @@ -62,7 +63,7 @@ fn main() { // This will not compile because `Structure` does not implement // fmt::Display. - //println!("This struct `{}` won't print...", Structure(3)); + // println!("This struct `{}` won't print...", Structure(3)); // TODO ^ Try uncommenting this line // For Rust 1.58 and above, you can directly capture the argument from a diff --git a/src/doc/rust-by-example/src/primitives/array.md b/src/doc/rust-by-example/src/primitives/array.md index 9cec24d69..5f5e69944 100644 --- a/src/doc/rust-by-example/src/primitives/array.md +++ b/src/doc/rust-by-example/src/primitives/array.md @@ -63,7 +63,9 @@ fn main() { } } - // Out of bound indexing causes compile time error. + // Out of bound indexing on array causes compile time error. //println!("{}", xs[5]); + // Out of bound indexing on slice causes runtime error. + //println!("{}", xs[..][5]); } ``` -- cgit v1.2.3