feat: completed solutions

This commit is contained in:
2026-03-23 03:36:33 -04:00
parent 2279bea6f1
commit f568c094cb
65 changed files with 424 additions and 139 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
fn main() {
// TODO: Fix the Clippy lint in this line.
let pi = 3.14;
let pi = std::f32::consts::PI;
let radius: f32 = 5.0;
let area = pi * radius.powi(2);
+2 -1
View File
@@ -1,8 +1,9 @@
fn main() {
let mut res = 42;
let option = Some(12);
// TODO: Fix the Clippy lint.
for x in option {
if let Some(x) = option {
res += x;
}
+6 -6
View File
@@ -7,23 +7,23 @@ fn main() {
let my_option: Option<&str> = None;
// Assume that you don't know the value of `my_option`.
// In the case of `Some`, we want to print its value.
if my_option.is_none() {
println!("{}", my_option.unwrap());
if let Some(my_option) = my_option {
println!("{}", my_option);
}
let my_arr = &[
-1, -2, -3
-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);
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;
std::mem::swap(&mut value_a, &mut value_b);
println!("value a: {value_a}; value b: {value_b}");
}