Merge pull request #795 from yizeyi18/main

`listings/`: synchonize with english version
This commit is contained in:
KaiserY 2024-06-06 22:52:22 +08:00 committed by GitHub
commit d00679f57c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1986 changed files with 720 additions and 3251 deletions

0
listings/ch02-guessing-game-tutorial/listing-02-01/Cargo.lock generated Executable file → Normal file
View File

View File

View File

@ -25,7 +25,7 @@ fn main() {
// ANCHOR_END: expect
// ANCHOR: print_guess
println!("You guessed: {guess}");
println!("You guessed: {}", guess);
// ANCHOR_END: print_guess
}
// ANCHOR: all

16
listings/ch02-guessing-game-tutorial/listing-02-02/Cargo.lock generated Executable file → Normal file
View File

@ -10,9 +10,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "getrandom"
version = "0.2.7"
version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5"
dependencies = [
"cfg-if",
"libc",
@ -28,15 +28,15 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.127"
version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "505e71a4706fa491e9b1b55f51b95d4037d0821ee40131190475f692b35b009b"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
name = "ppv-lite86"
version = "0.2.16"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "rand"
@ -61,9 +61,9 @@ dependencies = [
[[package]]
name = "rand_core"
version = "0.6.3"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
"getrandom",
]

View File

View File

0
listings/ch02-guessing-game-tutorial/listing-02-03/Cargo.lock generated Executable file → Normal file
View File

View File

View File

0
listings/ch02-guessing-game-tutorial/listing-02-04/Cargo.lock generated Executable file → Normal file
View File

View File

View File

@ -11,13 +11,14 @@ error[E0308]: mismatched types
--> src/main.rs:22:21
|
22 | match guess.cmp(&secret_number) {
| --- ^^^^^^^^^^^^^^ expected struct `String`, found integer
| --- ^^^^^^^^^^^^^^ expected `&String`, found `&{integer}`
| |
| arguments to this function are incorrect
| arguments to this method are incorrect
|
= note: expected reference `&String`
found reference `&{integer}`
note: associated function defined here
note: method defined here
--> /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/cmp.rs:836:8
For more information about this error, try `rustc --explain E0308`.
error: could not compile `guessing_game` due to previous error
error: could not compile `guessing_game` (bin "guessing_game") due to 1 previous error

View File

0
listings/ch02-guessing-game-tutorial/listing-02-05/Cargo.lock generated Executable file → Normal file
View File

View File

View File

0
listings/ch02-guessing-game-tutorial/listing-02-06/Cargo.lock generated Executable file → Normal file
View File

View File

View File

View File

View File

@ -1,5 +1,5 @@
$ cargo run
Compiling guessing_game v0.1.0 (file:///projects/guessing_game)
Finished dev [unoptimized + debuginfo] target(s) in 1.50s
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.50s
Running `target/debug/guessing_game`
Hello, world!

View File

View File

@ -4,10 +4,14 @@ warning: unused `Result` that must be used
--> src/main.rs:10:5
|
10 | io::stdin().read_line(&mut guess);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_must_use)]` on by default
= note: this `Result` may be an `Err` variant, which should be handled
= note: `#[warn(unused_must_use)]` on by default
help: use `let _ = ...` to ignore the resulting value
|
10 | let _ = io::stdin().read_line(&mut guess);
| +++++++
warning: `guessing_game` (bin "guessing_game") generated 1 warning
Finished dev [unoptimized + debuginfo] target(s) in 0.59s
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.59s

0
listings/ch02-guessing-game-tutorial/no-listing-04-looping/Cargo.lock generated Executable file → Normal file
View File

View File

View File

View File

View File

0
listings/ch03-common-programming-concepts/listing-03-01/Cargo.lock generated Executable file → Normal file
View File

View File

View File

0
listings/ch03-common-programming-concepts/listing-03-02/Cargo.lock generated Executable file → Normal file
View File

View File

View File

@ -1,5 +1,5 @@
$ cargo run
Compiling branches v0.1.0 (file:///projects/branches)
Finished dev [unoptimized + debuginfo] target(s) in 0.30s
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.30s
Running `target/debug/branches`
The value of number is: 5

View File

0
listings/ch03-common-programming-concepts/listing-03-03/Cargo.lock generated Executable file → Normal file
View File

View File

View File

0
listings/ch03-common-programming-concepts/listing-03-04/Cargo.lock generated Executable file → Normal file
View File

View File

View File

@ -1,6 +1,6 @@
$ cargo run
Compiling loops v0.1.0 (file:///projects/loops)
Finished dev [unoptimized + debuginfo] target(s) in 0.32s
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.32s
Running `target/debug/loops`
the value is: 10
the value is: 20

View File

0
listings/ch03-common-programming-concepts/listing-03-05/Cargo.lock generated Executable file → Normal file
View File

View File

View File

View File

@ -13,4 +13,4 @@ error[E0384]: cannot assign twice to immutable variable `x`
| ^^^^^ cannot assign twice to immutable variable
For more information about this error, try `rustc --explain E0384`.
error: could not compile `variables` due to previous error
error: could not compile `variables` (bin "variables") due to 1 previous error

View File

View File

@ -1,6 +1,6 @@
$ cargo run
Compiling variables v0.1.0 (file:///projects/variables)
Finished dev [unoptimized + debuginfo] target(s) in 0.30s
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.30s
Running `target/debug/variables`
The value of x is: 5
The value of x is: 6

View File

View File

@ -1,6 +1,6 @@
$ cargo run
Compiling variables v0.1.0 (file:///projects/variables)
Finished dev [unoptimized + debuginfo] target(s) in 0.31s
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.31s
Running `target/debug/variables`
The value of x in the inner scope is: 12
The value of x is: 6

View File

@ -9,4 +9,4 @@ error[E0308]: mismatched types
| ^^^^^^^^^^^^ expected `&str`, found `usize`
For more information about this error, try `rustc --explain E0308`.
error: could not compile `variables` due to previous error
error: could not compile `variables` (bin "variables") due to 1 previous error

View File

View File

View File

View File

View File

View File

View File

View File

Some files were not shown because too many files have changed in this diff Show More