Skip to content

Commit 6ea6650

Browse files
authored
chore(cargo): bump up dependencies and adjust some code based on clippy (yamafaktory#36)
1 parent ee16f1d commit 6ea6650

File tree

5 files changed

+23
-24
lines changed

5 files changed

+23
-24
lines changed

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ version = "1.3.5"
1414

1515
[dependencies]
1616
indexmap = { version = "1.9.1", features = ["rayon"] }
17-
itertools = "0.10.3"
17+
itertools = "0.10.5"
1818
rayon = "1.5.3"
19-
thiserror = "1.0.34"
19+
thiserror = "1.0.37"
2020

2121
[dev-dependencies]
2222
criterion = "0.4.0"

src/core/iterator.rs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,20 @@ where
4545
// Convert the internal vertices to a vector of VertexIndex.
4646
// Since this is a fallible operation and we can't deal with a
4747
// Result within this iterator, remap to None on error.
48-
match self.hypergraph.get_vertices(vertices.to_owned()) {
49-
Ok(indexes) => {
50-
indexes
51-
.par_iter()
52-
.map(|index| self.hypergraph.get_vertex_weight(*index))
53-
.collect::<Result<Vec<&V>, HypergraphError<V, HE>>>()
54-
.ok()
55-
.map(|vertices_weights| {
56-
// Now we can increment the inner index.
57-
self.index += 1;
48+
if let Ok(indexes) = self.hypergraph.get_vertices(vertices.to_owned()) {
49+
indexes
50+
.par_iter()
51+
.map(|index| self.hypergraph.get_vertex_weight(*index))
52+
.collect::<Result<Vec<&V>, HypergraphError<V, HE>>>()
53+
.ok()
54+
.map(|vertices_weights| {
55+
// Now we can increment the inner index.
56+
self.index += 1;
5857

59-
(*weight, vertices_weights.into_par_iter().cloned().collect())
60-
})
61-
}
62-
Err(_) => None,
58+
(*weight, vertices_weights.into_par_iter().cloned().collect())
59+
})
60+
} else {
61+
None
6362
}
6463
}
6564

src/core/vertices/get_full_adjacent_vertices_from.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ where
2525
IndexMap::<VertexIndex, Vec<HyperedgeIndex>>::new(),
2626
|mut acc, (hyperedge_index, vertex_index)| {
2727
if let Some(index) = vertex_index {
28-
let hyperedges = acc.entry(index).or_insert(vec![]);
28+
let hyperedges = acc.entry(index).or_default();
2929

3030
hyperedges.push(hyperedge_index);
3131
}

src/core/vertices/get_full_adjacent_vertices_to.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ where
2525
IndexMap::<VertexIndex, Vec<HyperedgeIndex>>::new(),
2626
|mut acc, (hyperedge_index, vertex_index)| {
2727
if let Some(index) = vertex_index {
28-
let hyperedges = acc.entry(index).or_insert(vec![]);
28+
let hyperedges = acc.entry(index).or_default();
2929

3030
hyperedges.push(hyperedge_index);
3131
}

0 commit comments

Comments
 (0)