diff --git a/rust/Justfile b/rust/Justfile new file mode 100644 index 00000000..124c16ed --- /dev/null +++ b/rust/Justfile @@ -0,0 +1,3 @@ +lint: + cargo fmt + cargo clippy --fix diff --git a/rust/eliuds-eggs/src/lib.rs b/rust/eliuds-eggs/src/lib.rs index 89773714..b5c3af3b 100644 --- a/rust/eliuds-eggs/src/lib.rs +++ b/rust/eliuds-eggs/src/lib.rs @@ -8,7 +8,7 @@ fn decimal_to_binary(decimal: u32) -> String { let mut n = decimal; while n != 0 { let remainder = n % 2; - n = n / 2; + n /= 2; result.insert(0, char::from_digit(remainder, 10).unwrap()); } result diff --git a/rust/kindergarten-garden/src/lib.rs b/rust/kindergarten-garden/src/lib.rs index e0186c14..321a9461 100644 --- a/rust/kindergarten-garden/src/lib.rs +++ b/rust/kindergarten-garden/src/lib.rs @@ -8,7 +8,7 @@ pub fn plants(diagram: &str, name: &str) -> Vec<&'static str> { let plant = get_plant(encoding); result.push(plant.string()); } - }; + } result } @@ -16,7 +16,7 @@ enum Plant { Grass, Clover, Radishes, - Violets + Violets, } impl Plant { @@ -36,11 +36,10 @@ fn get_plant(encoding: char) -> Plant { 'C' => Plant::Clover, 'R' => Plant::Radishes, 'V' => Plant::Violets, - _ => panic!("Invalid plant encoding") - } + _ => panic!("Invalid plant encoding"), + }; } - enum Student { Alice, Bob, @@ -53,7 +52,7 @@ enum Student { Ileana, Joseph, Kincaid, - Larry + Larry, } fn parse_student(name: &str) -> Student { @@ -70,8 +69,8 @@ fn parse_student(name: &str) -> Student { "Joseph" => Student::Joseph, "Kincaid" => Student::Kincaid, "Larry" => Student::Larry, - _ => panic!("Invalid student name") - } + _ => panic!("Invalid student name"), + }; } impl Student { @@ -89,6 +88,6 @@ impl Student { Student::Joseph => vec![18, 19], Student::Kincaid => vec![20, 21], Student::Larry => vec![22, 23], - } + }; } }