Skip to content

Commit 29b30ec

Browse files
committed
Merge branch 'master' of https://github.com/sjmann/rustlings into generics-exercises
2 parents 76be5e4 + 8b94790 commit 29b30ec

File tree

17 files changed

+378
-187
lines changed

17 files changed

+378
-187
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
target/
33
**/*.rs.bk
44
.DS_Store
5+
*.pdb
6+
exercises/clippy/Cargo.toml
7+
exercises/clippy/Cargo.lock

CHANGELOG.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,44 @@
1+
<a name="2.2.1"></a>
2+
### 2.2.1 (2020-02-27)
3+
4+
#### Bug Fixes
5+
6+
* Re-add cloning the repo to install scripts ([3d9b03c5](https://github.com/rust-lang/rustlings/commit/3d9b03c52b8dc51b140757f6fd25ad87b5782ef5))
7+
8+
#### Features
9+
10+
* Add clippy lints (#269) ([1e2fd9c9](https://github.com/rust-lang/rustlings/commit/1e2fd9c92f8cd6e389525ca1a999fca4c90b5921))
11+
12+
<a name="2.2.0"></a>
13+
## 2.2.0 (2020-02-25)
14+
15+
16+
#### Bug Fixes
17+
18+
* Update deps to version compatable with aarch64-pc-windows (#263) ([19a93428](https://github.com/rust-lang/rustlings/commit/19a93428b3c73d994292671f829bdc8e5b7b3401))
19+
* **docs:**
20+
* Added a necessary step to Windows installation process (#242) ([3906efcd](https://github.com/rust-lang/rustlings/commit/3906efcd52a004047b460ed548037093de3f523f))
21+
* Fixed mangled sentence from book; edited for clarity (#266) ([ade52ff](https://github.com/rust-lang/rustlings/commit/ade52ffb739987287ddd5705944c8777705faed9))
22+
* Updated iterators readme to account for iterators4 exercise (#273) ([bec8e3a](https://github.com/rust-lang/rustlings/commit/bec8e3a644cbd88db1c73ea5f1d8a364f4a34016))
23+
* **installation:** make fatal errors more obvious (#272) ([17d0951e](https://github.com/rust-lang/rustlings/commit/17d0951e66fda8e11b204d5c4c41a0d5e22e78f7))
24+
* **iterators2:**
25+
* Remove reference to missing iterators2.rs (#245) ([419f7797](https://github.com/rust-lang/rustlings/commit/419f7797f294e4ce6a2b883199731b5bde77d262))
26+
* **as_ref_mut:** Enable a test and improve per clippy's suggestion (#256) ([dfdf809](https://github.com/rust-lang/rustlings/commit/dfdf8093ebbd4145864995627b812780de52f902))
27+
* **tests1:**
28+
* Change test command ([fe10e06c](https://github.com/rust-lang/rustlings/commit/fe10e06c3733ddb4a21e90d09bf79bfe618e97ce)
29+
* Correct test command in tests1.rs comment (#263) ([39fa7ae](https://github.com/rust-lang/rustlings/commit/39fa7ae8b70ad468da49b06f11b2383135a63bcf))
30+
31+
#### Features
32+
33+
* Add variables5.rs exercise (#264) ([0c73609e](https://github.com/rust-lang/rustlings/commit/0c73609e6f2311295e95d6f96f8c747cfc4cba03))
34+
* Show a completion message when watching (#253) ([d25ee55a](https://github.com/rust-lang/rustlings/commit/d25ee55a3205882d35782e370af855051b39c58c))
35+
* Add type conversion and parsing exercises (#249) ([0c85dc11](https://github.com/rust-lang/rustlings/commit/0c85dc1193978b5165491b99cc4922caf8d14a65))
36+
* Created consistent money unit (#258) ([fd57f8f](https://github.com/rust-lang/rustlings/commit/fd57f8f2c1da2af8ddbebbccec214e6f40f4dbab))
37+
* Enable test for exercise test4 (#276) ([8b971ff](https://github.com/rust-lang/rustlings/commit/8b971ffab6079a706ac925f5917f987932b55c07))
38+
* Added traits exercises (#274 but specifically #216, which originally added
39+
this :heart:) ([b559cdd](https://github.com/rust-lang/rustlings/commit/b559cdd73f32c0d0cfc1feda39f82b3e3583df17))
40+
41+
142
<a name="2.1.0"></a>
243
## 2.1.0 (2019-11-27)
344

Cargo.lock

Lines changed: 45 additions & 86 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rustlings"
3-
version = "2.1.0"
3+
version = "2.2.1"
44
authors = ["Marisa <mokou@posteo.de>", "Carol (Nichols || Goulding) <carol.nichols@gmail.com"]
55
edition = "2018"
66

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Basically: Clone the repository, checkout to the latest tag, run `cargo install`
5454
```bash
5555
git clone https://github.com/rust-lang/rustlings
5656
cd rustlings
57-
git checkout tags/2.1.0 # or whatever the latest version is (find out at https://github.com/rust-lang/rustlings/releases/latest)
57+
git checkout tags/2.2.1 # or whatever the latest version is (find out at https://github.com/rust-lang/rustlings/releases/latest)
5858
cargo install --force --path .
5959
```
6060

exercises/clippy/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
### Clippy
2+
3+
The Clippy tool is a collection of lints to analyze your code so you can catch common mistakes and improve your Rust code.
4+
5+
If you used the installation script for Rustlings, Clippy should be already installed.
6+
If not you can install it manually via `rustup component add clippy`.
7+
8+
For more information about Clippy lints, please see [their documentation page](https://rust-lang.github.io/rust-clippy/master/).

exercises/clippy/clippy1.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// clippy1.rs
2+
// The Clippy tool is a collection of lints to analyze your code
3+
// so you can catch common mistakes and improve your Rust code.
4+
//
5+
// Execute `rustlings hint clippy1` for hints :)
6+
7+
// I AM NOT DONE
8+
9+
fn main() {
10+
let x = 1.2331f64;
11+
let y = 1.2332f64;
12+
if y != x {
13+
println!("Success!");
14+
}
15+
}

exercises/clippy/clippy2.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// clippy2.rs
2+
// Make me compile! Execute `rustlings hint clippy2` for hints :)
3+
4+
// I AM NOT DONE
5+
6+
fn main() {
7+
let mut res = 42;
8+
let option = Some(12);
9+
for x in option {
10+
res += x;
11+
}
12+
println!("{}", res);
13+
}

exercises/test4.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,17 @@
77

88
// I AM NOT DONE
99

10-
fn main() {
11-
if my_macro!("world!") != "Hello world!" {
12-
panic!("Oh no! Wrong output!");
10+
#[cfg(test)]
11+
mod tests {
12+
use super::*;
13+
14+
#[test]
15+
fn test_my_macro_world() {
16+
assert_eq!(my_macro!("world!"), "Hello world!");
17+
}
18+
19+
#[test]
20+
fn test_my_macro_goodbye() {
21+
assert_eq!(my_macro!("goodbye!"), "Hello goodbye!");
1322
}
1423
}

info.toml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ The way macros are written, it wants to see something between each
369369
[[exercises]]
370370
name = "test4"
371371
path = "exercises/test4.rs"
372-
mode = "compile"
372+
mode = "test"
373373
hint = "No hints this time ;)"
374374

375375
# MOVE SEMANTICS
@@ -529,6 +529,22 @@ hint = """
529529
It should be doing some checking, returning an `Err` result if those checks fail, and only
530530
returning an `Ok` result if those checks determine that everything is... okay :)"""
531531

532+
# CLIPPY
533+
534+
[[exercises]]
535+
name = "clippy1"
536+
path = "exercises/clippy/clippy1.rs"
537+
mode = "clippy"
538+
hint = """
539+
Floating point calculations are usually imprecise, so asking if two values are exactly equal is asking for trouble"""
540+
541+
[[exercises]]
542+
name = "clippy2"
543+
path = "exercises/clippy/clippy2.rs"
544+
mode = "clippy"
545+
hint = """
546+
`for` loops over Option values are more clearly expressed as an `if let`"""
547+
532548
# STANDARD LIBRARY TYPES
533549

534550
[[exercises]]

0 commit comments

Comments
 (0)