Skip to content

Commit 5548b79

Browse files
committed
lint
1 parent 8d38402 commit 5548b79

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

rust/Justfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
lint:
2+
cargo fmt
3+
cargo clippy --fix

rust/eliuds-eggs/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn decimal_to_binary(decimal: u32) -> String {
88
let mut n = decimal;
99
while n != 0 {
1010
let remainder = n % 2;
11-
n = n / 2;
11+
n /= 2;
1212
result.insert(0, char::from_digit(remainder, 10).unwrap());
1313
}
1414
result

rust/kindergarten-garden/src/lib.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ pub fn plants(diagram: &str, name: &str) -> Vec<&'static str> {
88
let plant = get_plant(encoding);
99
result.push(plant.string());
1010
}
11-
};
11+
}
1212
result
1313
}
1414

1515
enum Plant {
1616
Grass,
1717
Clover,
1818
Radishes,
19-
Violets
19+
Violets,
2020
}
2121

2222
impl Plant {
@@ -36,11 +36,10 @@ fn get_plant(encoding: char) -> Plant {
3636
'C' => Plant::Clover,
3737
'R' => Plant::Radishes,
3838
'V' => Plant::Violets,
39-
_ => panic!("Invalid plant encoding")
40-
}
39+
_ => panic!("Invalid plant encoding"),
40+
};
4141
}
4242

43-
4443
enum Student {
4544
Alice,
4645
Bob,
@@ -53,7 +52,7 @@ enum Student {
5352
Ileana,
5453
Joseph,
5554
Kincaid,
56-
Larry
55+
Larry,
5756
}
5857

5958
fn parse_student(name: &str) -> Student {
@@ -70,8 +69,8 @@ fn parse_student(name: &str) -> Student {
7069
"Joseph" => Student::Joseph,
7170
"Kincaid" => Student::Kincaid,
7271
"Larry" => Student::Larry,
73-
_ => panic!("Invalid student name")
74-
}
72+
_ => panic!("Invalid student name"),
73+
};
7574
}
7675

7776
impl Student {
@@ -89,6 +88,6 @@ impl Student {
8988
Student::Joseph => vec![18, 19],
9089
Student::Kincaid => vec![20, 21],
9190
Student::Larry => vec![22, 23],
92-
}
91+
};
9392
}
9493
}

0 commit comments

Comments
 (0)