Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
rootulp committed Jan 7, 2025
1 parent 8d38402 commit 5548b79
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
3 changes: 3 additions & 0 deletions rust/Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
lint:
cargo fmt
cargo clippy --fix
2 changes: 1 addition & 1 deletion rust/eliuds-eggs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 8 additions & 9 deletions rust/kindergarten-garden/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ pub fn plants(diagram: &str, name: &str) -> Vec<&'static str> {
let plant = get_plant(encoding);
result.push(plant.string());
}
};
}
result
}

enum Plant {
Grass,
Clover,
Radishes,
Violets
Violets,
}

impl Plant {
Expand All @@ -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,
Expand All @@ -53,7 +52,7 @@ enum Student {
Ileana,
Joseph,
Kincaid,
Larry
Larry,
}

fn parse_student(name: &str) -> Student {
Expand All @@ -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 {
Expand All @@ -89,6 +88,6 @@ impl Student {
Student::Joseph => vec![18, 19],
Student::Kincaid => vec![20, 21],
Student::Larry => vec![22, 23],
}
};
}
}

0 comments on commit 5548b79

Please sign in to comment.