Skip to content

Commit

Permalink
Fix clippy findings for Rust 1.74 (#1030)
Browse files Browse the repository at this point in the history
* Fix dijkstra's error occurrences

* Fix clippy in score.rs
  • Loading branch information
IvanIsCoding authored Nov 21, 2023
1 parent dc617e9 commit 641f0f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions rustworkx-core/src/shortest_path/dijkstra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ where
let zero_score = K::default();
scores.put_item(start, zero_score);
visit_next.push(MinScored(zero_score, start));
if path.is_some() {
path.as_mut().unwrap().insert(start, vec![start]);
if let Some(path_mut) = &mut path {
path_mut.insert(start, vec![start]);
}
while let Some(MinScored(node_score, node)) = visit_next.pop() {
if visited.is_visited(&node) {
Expand All @@ -139,10 +139,10 @@ where
if next_score < *current_score {
scores.put_item(next, next_score);
visit_next.push(MinScored(next_score, next));
if path.is_some() {
let mut node_path = path.as_mut().unwrap().get(&node).unwrap().clone();
if let Some(path_mut) = &mut path {
let mut node_path = path_mut.get(&node).unwrap().clone();
node_path.push(next);
path.as_mut().unwrap().entry(next).and_modify(|new_vec| {
path_mut.entry(next).and_modify(|new_vec| {
*new_vec = node_path;
});
}
Expand All @@ -151,10 +151,10 @@ where
None => {
scores.put_item(next, next_score);
visit_next.push(MinScored(next_score, next));
if path.is_some() {
let mut node_path = path.as_mut().unwrap().get(&node).unwrap().clone();
if let Some(path_mut) = &mut path {
let mut node_path = path_mut.get(&node).unwrap().clone();
node_path.push(next);
path.as_mut().unwrap().entry(next).or_insert(node_path);
path_mut.entry(next).or_insert(node_path);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/score.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// License for the specific language governing permissions and limitations
// under the License.
#![allow(clippy::derive_partial_eq_without_eq)]
#![allow(clippy::incorrect_partial_ord_impl_on_ord_type)]
#![allow(clippy::non_canonical_partial_ord_impl)]

use std::cmp::Ordering;
use std::ops::{Add, AddAssign};
Expand Down

0 comments on commit 641f0f9

Please sign in to comment.