Skip to content

Commit

Permalink
Fix clippy with Rust 1.66.0 (#762)
Browse files Browse the repository at this point in the history
The recent release of Rust 1.66.0 [1] added new on by default clippy rules
which are causing failures when we run the clippy CI job with the new
rust version. This commit updates the code to fix the issues that clippy
has identified which will unblock CI.

[1] https://blog.rust-lang.org/2022/12/15/Rust-1.66.0.html
  • Loading branch information
mtreinish authored and IvanIsCoding committed Feb 27, 2023
1 parent 88fc0ac commit 3e22286
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/digraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2688,14 +2688,14 @@ impl PyDiGraph {
}

fn __getitem__(&self, idx: usize) -> PyResult<&PyObject> {
match self.graph.node_weight(NodeIndex::new(idx as usize)) {
match self.graph.node_weight(NodeIndex::new(idx)) {
Some(data) => Ok(data),
None => Err(PyIndexError::new_err("No node found for index")),
}
}

fn __setitem__(&mut self, idx: usize, value: PyObject) -> PyResult<()> {
let data = match self.graph.node_weight_mut(NodeIndex::new(idx as usize)) {
let data = match self.graph.node_weight_mut(NodeIndex::new(idx)) {
Some(node_data) => node_data,
None => return Err(PyIndexError::new_err("No node found for index")),
};
Expand All @@ -2704,7 +2704,7 @@ impl PyDiGraph {
}

fn __delitem__(&mut self, idx: usize) -> PyResult<()> {
match self.graph.remove_node(NodeIndex::new(idx as usize)) {
match self.graph.remove_node(NodeIndex::new(idx)) {
Some(_) => Ok(()),
None => Err(PyIndexError::new_err("No node found for index")),
}
Expand Down
2 changes: 1 addition & 1 deletion src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1746,7 +1746,7 @@ impl PyGraph {
}

fn __delitem__(&mut self, idx: usize) -> PyResult<()> {
match self.graph.remove_node(NodeIndex::new(idx as usize)) {
match self.graph.remove_node(NodeIndex::new(idx)) {
Some(_) => Ok(()),
None => Err(PyIndexError::new_err("No node found for index")),
}
Expand Down

0 comments on commit 3e22286

Please sign in to comment.