summaryrefslogtreecommitdiffstats
path: root/src/doc/book/listings/ch05-using-structs-to-structure-related-data
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc/book/listings/ch05-using-structs-to-structure-related-data')
-rw-r--r--src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-02/src/main.rs4
-rw-r--r--src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-03/src/main.rs4
-rw-r--r--src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-04/src/main.rs4
-rw-r--r--src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-05/src/main.rs4
-rw-r--r--src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-11/output.txt2
-rw-r--r--src/doc/book/listings/ch05-using-structs-to-structure-related-data/output-only-01-debug/output.txt2
6 files changed, 10 insertions, 10 deletions
diff --git a/src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-02/src/main.rs b/src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-02/src/main.rs
index e0f7a6cd3..122d25164 100644
--- a/src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-02/src/main.rs
+++ b/src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-02/src/main.rs
@@ -8,9 +8,9 @@ struct User {
// ANCHOR: here
fn main() {
let user1 = User {
- email: String::from("someone@example.com"),
- username: String::from("someusername123"),
active: true,
+ username: String::from("someusername123"),
+ email: String::from("someone@example.com"),
sign_in_count: 1,
};
}
diff --git a/src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-03/src/main.rs b/src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-03/src/main.rs
index 7a078e7e8..35eea8a9a 100644
--- a/src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-03/src/main.rs
+++ b/src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-03/src/main.rs
@@ -8,9 +8,9 @@ struct User {
// ANCHOR: here
fn main() {
let mut user1 = User {
- email: String::from("someone@example.com"),
- username: String::from("someusername123"),
active: true,
+ username: String::from("someusername123"),
+ email: String::from("someone@example.com"),
sign_in_count: 1,
};
diff --git a/src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-04/src/main.rs b/src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-04/src/main.rs
index aa7823af4..8614561c1 100644
--- a/src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-04/src/main.rs
+++ b/src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-04/src/main.rs
@@ -8,9 +8,9 @@ struct User {
// ANCHOR: here
fn build_user(email: String, username: String) -> User {
User {
- email: email,
- username: username,
active: true,
+ username: username,
+ email: email,
sign_in_count: 1,
}
}
diff --git a/src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-05/src/main.rs b/src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-05/src/main.rs
index 8d84a3060..c893c86a9 100644
--- a/src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-05/src/main.rs
+++ b/src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-05/src/main.rs
@@ -8,9 +8,9 @@ struct User {
// ANCHOR: here
fn build_user(email: String, username: String) -> User {
User {
- email,
- username,
active: true,
+ username,
+ email,
sign_in_count: 1,
}
}
diff --git a/src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-11/output.txt b/src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-11/output.txt
index b761fccd6..7d3bfcdac 100644
--- a/src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-11/output.txt
+++ b/src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-11/output.txt
@@ -8,7 +8,7 @@ error[E0277]: `Rectangle` doesn't implement `std::fmt::Display`
|
= help: the trait `std::fmt::Display` is not implemented for `Rectangle`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
- = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0277`.
error: could not compile `rectangles` due to previous error
diff --git a/src/doc/book/listings/ch05-using-structs-to-structure-related-data/output-only-01-debug/output.txt b/src/doc/book/listings/ch05-using-structs-to-structure-related-data/output-only-01-debug/output.txt
index 69c8b38a6..58cb842bf 100644
--- a/src/doc/book/listings/ch05-using-structs-to-structure-related-data/output-only-01-debug/output.txt
+++ b/src/doc/book/listings/ch05-using-structs-to-structure-related-data/output-only-01-debug/output.txt
@@ -8,7 +8,7 @@ error[E0277]: `Rectangle` doesn't implement `Debug`
|
= help: the trait `Debug` is not implemented for `Rectangle`
= note: add `#[derive(Debug)]` to `Rectangle` or manually `impl Debug for Rectangle`
- = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider annotating `Rectangle` with `#[derive(Debug)]`
|
1 | #[derive(Debug)]