Update codes of ch2

This commit is contained in:
Aaran Xu 2022-02-02 16:24:47 +08:00
parent bb019b48b0
commit ea43bbd056
43 changed files with 57 additions and 50 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "functions"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "branches"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "loops"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "loops"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "loops"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "variables"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "variables"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "variables"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "variables"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "variables"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -3,6 +3,8 @@ $ cargo run
error[E0308]: mismatched types
--> src/main.rs:3:14
|
2 | let mut spaces = " ";
| ----- expected due to this value
3 | spaces = spaces.len();
| ^^^^^^^^^^^^ expected `&str`, found `usize`

View File

@ -1,6 +1,6 @@
[package]
name = "floating-point"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "numeric-operations"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "boolean"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "char"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "tuples"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "tuples"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "tuples"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "arrays"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "arrays"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "arrays"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "functions"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "functions"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "functions"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "functions"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,5 +1,13 @@
$ cargo run
Compiling functions v0.1.0 (file:///projects/functions)
error: expected expression, found statement (`let`)
--> src/main.rs:2:14
|
2 | let x = (let y = 6);
| ^^^^^^^^^
|
= note: variable declaration using `let` is a statement
error[E0658]: `let` expressions in this position are experimental
--> src/main.rs:2:14
|
@ -9,21 +17,18 @@ error[E0658]: `let` expressions in this position are experimental
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: you can write `matches!(<expr>, <pattern>)` instead of `let <pattern> = <expr>`
error: expected expression, found statement (`let`)
--> src/main.rs:2:14
|
2 | let x = (let y = 6);
| ^^^^^^^^^
|
= note: variable declaration using `let` is a statement
warning: unnecessary parentheses around assigned value
--> src/main.rs:2:13
|
2 | let x = (let y = 6);
| ^^^^^^^^^^^ help: remove these parentheses
| ^ ^
|
= note: `#[warn(unused_parens)]` on by default
help: remove these parentheses
|
2 - let x = (let y = 6);
2 + let x = let y = 6;
|
For more information about this error, try `rustc --explain E0658`.
warning: `functions` (bin "functions") generated 1 warning

View File

@ -1,6 +1,6 @@
[package]
name = "functions"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "functions"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "functions"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "functions"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "comments"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "comments"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "branches"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "branches"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "branches"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "branches"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "branches"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "branches"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "loops"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "loops"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "loops"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "loops"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]

View File

@ -1,7 +1,7 @@
[package]
name = "no_type_annotations"
version = "0.1.0"
edition = "2018"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html