Skip to content

Commit 2ef793f

Browse files
committed
Fixed according to cargo clippy
1 parent 5bc4228 commit 2ef793f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/dsu.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ pub struct Dsu {
99
parent_or_size: Vec<i32>,
1010
}
1111

12+
1213
impl Dsu {
13-
pub fn new(n: usize) -> Self {
14+
pub fn new(size: usize) -> Self {
1415
Self {
15-
n: n,
16-
parent_or_size: vec![-1; n],
16+
n: size,
17+
parent_or_size: vec![-1; size],
1718
}
1819
}
1920
pub fn merge(&mut self, a: usize, b: usize) -> usize {
@@ -28,13 +29,13 @@ impl Dsu {
2829
}
2930
self.parent_or_size[x] += self.parent_or_size[y];
3031
self.parent_or_size[y] = x as i32;
31-
return x;
32+
x
3233
}
3334

3435
pub fn same(&mut self, a: usize, b: usize) -> bool {
3536
assert!(a < self.n);
3637
assert!(b < self.n);
37-
return self.leader(a) == self.leader(b);
38+
self.leader(a) == self.leader(b)
3839
}
3940
pub fn leader(&mut self, a: usize) -> usize {
4041
assert!(a < self.n);

0 commit comments

Comments
 (0)