diff options
| author | Mario Reder <mreder1289@gmail.com> | 2020-02-14 15:25:03 +0100 |
|---|---|---|
| committer | Mario Reder <mreder1289@gmail.com> | 2020-02-26 14:07:07 +0100 |
| commit | 1e2fd9c92f8cd6e389525ca1a999fca4c90b5921 (patch) | |
| tree | aace341dbef4b15e37ddf260d6be857a11cca104 /exercises | |
| parent | 7e8530b21ff355c9b52e07eb3ba25278746a6932 (diff) | |
feat: Add clippy lints
- adds a new 'clippy' category for exercises
- clippy exercises should throw no warnings
- install script now also installs clippy
is related to https://github.com/rust-lang/rust-clippy/issues/2604
Diffstat (limited to 'exercises')
| -rw-r--r-- | exercises/clippy/README.md | 8 | ||||
| -rw-r--r-- | exercises/clippy/clippy1.rs | 15 | ||||
| -rw-r--r-- | exercises/clippy/clippy2.rs | 13 |
3 files changed, 36 insertions, 0 deletions
diff --git a/exercises/clippy/README.md b/exercises/clippy/README.md new file mode 100644 index 0000000..60a12fe --- /dev/null +++ b/exercises/clippy/README.md @@ -0,0 +1,8 @@ +### Clippy + +The Clippy tool is a collection of lints to analyze your code so you can catch common mistakes and improve your Rust code. + +If you used the installation script for Rustlings, Clippy should be already installed. +If not you can install it manually via `rustup component add clippy`. + +For more information about Clippy lints, please see [their documentation page](https://rust-lang.github.io/rust-clippy/master/). diff --git a/exercises/clippy/clippy1.rs b/exercises/clippy/clippy1.rs new file mode 100644 index 0000000..2b4c635 --- /dev/null +++ b/exercises/clippy/clippy1.rs @@ -0,0 +1,15 @@ +// clippy1.rs +// The Clippy tool is a collection of lints to analyze your code +// so you can catch common mistakes and improve your Rust code. +// +// Execute `rustlings hint clippy1` for hints :) + +// I AM NOT DONE + +fn main() { + let x = 1.2331f64; + let y = 1.2332f64; + if y != x { + println!("Success!"); + } +} diff --git a/exercises/clippy/clippy2.rs b/exercises/clippy/clippy2.rs new file mode 100644 index 0000000..37af9ed --- /dev/null +++ b/exercises/clippy/clippy2.rs @@ -0,0 +1,13 @@ +// clippy2.rs +// Make me compile! Execute `rustlings hint clippy2` for hints :) + +// I AM NOT DONE + +fn main() { + let mut res = 42; + let option = Some(12); + for x in option { + res += x; + } + println!("{}", res); +} |
