From 64d95837e9813541cf5b357de13865ce687ae98d Mon Sep 17 00:00:00 2001 From: Adam Brewer Date: Mon, 16 Oct 2023 07:37:12 -0400 Subject: Update Exercises Directory Names to Reflect Order --- exercises/22_clippy/clippy3.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 exercises/22_clippy/clippy3.rs (limited to 'exercises/22_clippy/clippy3.rs') diff --git a/exercises/22_clippy/clippy3.rs b/exercises/22_clippy/clippy3.rs new file mode 100644 index 0000000..5a95f5b --- /dev/null +++ b/exercises/22_clippy/clippy3.rs @@ -0,0 +1,30 @@ +// clippy3.rs +// +// Here's a couple more easy Clippy fixes, so you can see its utility. +// No hints. + +// I AM NOT DONE + +#[allow(unused_variables, unused_assignments)] +fn main() { + let my_option: Option<()> = None; + if my_option.is_none() { + my_option.unwrap(); + } + + let my_arr = &[ + -1, -2, -3 + -4, -5, -6 + ]; + println!("My array! Here it is: {:?}", my_arr); + + let my_empty_vec = vec![1, 2, 3, 4, 5].resize(0, 5); + println!("This Vec is empty, see? {:?}", my_empty_vec); + + let mut value_a = 45; + let mut value_b = 66; + // Let's swap these two! + value_a = value_b; + value_b = value_a; + println!("value a: {}; value b: {}", value_a, value_b); +} -- cgit v1.2.3