Merge pull request #795 from yizeyi18/main

`listings/`: synchonize with english version
pull/796/head
KaiserY 6 months ago committed by GitHub
commit d00679f57c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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

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

@ -11,13 +11,14 @@ error[E0308]: mismatched types
--> src/main.rs:22:21 --> src/main.rs:22:21
| |
22 | match guess.cmp(&secret_number) { 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` = note: expected reference `&String`
found reference `&{integer}` 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`. 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

@ -1,5 +1,5 @@
$ cargo run $ cargo run
Compiling guessing_game v0.1.0 (file:///projects/guessing_game) 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` Running `target/debug/guessing_game`
Hello, world! Hello, world!

@ -4,10 +4,14 @@ warning: unused `Result` that must be used
--> src/main.rs:10:5 --> src/main.rs:10:5
| |
10 | io::stdin().read_line(&mut guess); 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: 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 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

@ -1,5 +1,5 @@
$ cargo run $ cargo run
Compiling branches v0.1.0 (file:///projects/branches) 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` Running `target/debug/branches`
The value of number is: 5 The value of number is: 5

@ -1,6 +1,6 @@
$ cargo run $ cargo run
Compiling loops v0.1.0 (file:///projects/loops) 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` Running `target/debug/loops`
the value is: 10 the value is: 10
the value is: 20 the value is: 20

@ -13,4 +13,4 @@ error[E0384]: cannot assign twice to immutable variable `x`
| ^^^^^ cannot assign twice to immutable variable | ^^^^^ cannot assign twice to immutable variable
For more information about this error, try `rustc --explain E0384`. 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

@ -1,6 +1,6 @@
$ cargo run $ cargo run
Compiling variables v0.1.0 (file:///projects/variables) 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` Running `target/debug/variables`
The value of x is: 5 The value of x is: 5
The value of x is: 6 The value of x is: 6

@ -1,6 +1,6 @@
$ cargo run $ cargo run
Compiling variables v0.1.0 (file:///projects/variables) 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` Running `target/debug/variables`
The value of x in the inner scope is: 12 The value of x in the inner scope is: 12
The value of x is: 6 The value of x is: 6

@ -9,4 +9,4 @@ error[E0308]: mismatched types
| ^^^^^^^^^^^^ expected `&str`, found `usize` | ^^^^^^^^^^^^ expected `&str`, found `usize`
For more information about this error, try `rustc --explain E0308`. 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

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

Loading…
Cancel
Save