Skip to content

Commit df9f20e

Browse files
committed
just lint
1 parent 36e14a7 commit df9f20e

File tree

1 file changed

+5
-2
lines changed
  • rust/pascals-triangle/src

1 file changed

+5
-2
lines changed

rust/pascals-triangle/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pub struct PascalsTriangle {
44

55
impl PascalsTriangle {
66
pub fn new(row_count: u32) -> Self {
7-
let rows = (1..=row_count).map(|i| generate_row(i)).collect();
7+
let rows = (1..=row_count).map(generate_row).collect();
88
PascalsTriangle { rows }
99
}
1010

@@ -18,7 +18,10 @@ fn generate_row(row_index: u32) -> Vec<u32> {
1818
return vec![1];
1919
}
2020
let prev_row = generate_row(row_index - 1);
21-
let mut row: Vec<u32> = prev_row.windows(2).map(|window| window[0] + window[1]).collect();
21+
let mut row: Vec<u32> = prev_row
22+
.windows(2)
23+
.map(|window| window[0] + window[1])
24+
.collect();
2225
row.insert(0, 1);
2326
row.push(1);
2427
row

0 commit comments

Comments
 (0)