Skip to content

Commit 2a1af6a

Browse files
committed
cargo fix
1 parent ea70c5e commit 2a1af6a

5 files changed

Lines changed: 13 additions & 13 deletions

File tree

rust/collatz-conjecture/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pub fn collatz(n: u64) -> Option<u64> {
22
if n == 0 {
33
return None;
44
}
5-
return Some(num_steps(n, 0));
5+
Some(num_steps(n, 0))
66
}
77

88
fn num_steps(n: u64, steps: u64) -> u64 {
@@ -12,9 +12,9 @@ fn num_steps(n: u64, steps: u64) -> u64 {
1212
if is_even(n) {
1313
return num_steps(n / 2, steps + 1);
1414
}
15-
return num_steps((3 * n) + 1, steps + 1);
15+
num_steps((3 * n) + 1, steps + 1)
1616
}
1717

1818
fn is_even(n: u64) -> bool {
19-
return n % 2 == 0;
19+
n % 2 == 0
2020
}

rust/grade-school/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl<'a> School<'a> {
3737
}
3838
}
3939

40-
impl<'a> Default for School<'a> {
40+
impl Default for School<'_> {
4141
fn default() -> Self {
4242
Self::new()
4343
}

rust/high-scores/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ impl<'a> HighScores<'a> {
1313
}
1414

1515
pub fn latest(&self) -> Option<u32> {
16-
return self.scores.last().copied();
16+
self.scores.last().copied()
1717
}
1818

1919
pub fn personal_best(&self) -> Option<u32> {
20-
return self.scores.iter().max().copied();
20+
self.scores.iter().max().copied()
2121
}
2222

2323
pub fn personal_top_three(&self) -> Vec<u32> {

rust/minesweeper/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,21 @@ impl Board {
3535
}
3636

3737
fn annotate(&self) -> Vec<String> {
38-
return self
38+
self
3939
.field
4040
.iter()
4141
.enumerate()
4242
.map(|(row, _)| self.annotate_row(row))
43-
.collect();
43+
.collect()
4444
}
4545

4646
fn annotate_row(&self, y: usize) -> String {
4747
let row = &self.field[y];
48-
return row
48+
row
4949
.iter()
5050
.enumerate()
5151
.map(|(x, _)| self.annotate_location(y, x))
52-
.collect();
52+
.collect()
5353
}
5454

5555
fn annotate_location(&self, y: usize, x: usize) -> char {
@@ -68,11 +68,11 @@ impl Board {
6868
}
6969

7070
fn num_neighbor_mines(&self, y: u32, x: u32) -> usize {
71-
return self
71+
self
7272
.get_neighbors(y, x)
7373
.iter()
7474
.filter(|neighbor| neighbor == &&&Token::Mine)
75-
.count();
75+
.count()
7676
}
7777

7878
fn get_neighbors(&self, y: u32, x: u32) -> Vec<&Token> {

rust/rna-transcription/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl Dna {
2929

3030
let mut converted = String::new();
3131

32-
for (_, c) in self.contents.chars().enumerate() {
32+
for c in self.contents.chars() {
3333
converted.push(*complements.get(&c).unwrap())
3434
}
3535

0 commit comments

Comments
 (0)