From b66662f7747642fadd1993686437a1fb2a7beb64 Mon Sep 17 00:00:00 2001 From: Etienne Wodey <44871469+airwoodix@users.noreply.github.com> Date: Sat, 30 Nov 2024 18:46:46 +0100 Subject: [PATCH] Fix clippy for Rust 1.83 (#1332) * clippy: fix empty_line_after_doc_comment * clippy: fix empty_line_after_outer_attr * clippy: autofix needless_return and needless_lifetimes * reno: add fragment for #1332 * Revert "reno: add fragment for #1332" This reverts commit 9d1b0c98dcf22206d05eef5e071fd7b19d96c905. --------- Co-authored-by: Ivan Carvalho --- rustworkx-core/src/generators/star_graph.rs | 2 +- rustworkx-core/src/token_swapper.rs | 1 - src/dag_algo/mod.rs | 6 +++--- src/digraph.rs | 4 ++-- src/graph.rs | 2 +- src/iterators.rs | 12 ++++++------ src/lib.rs | 2 +- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/rustworkx-core/src/generators/star_graph.rs b/rustworkx-core/src/generators/star_graph.rs index 4fea65d278..a09565c935 100644 --- a/rustworkx-core/src/generators/star_graph.rs +++ b/rustworkx-core/src/generators/star_graph.rs @@ -34,7 +34,7 @@ use super::InvalidInputError; /// * `bidirectional` - Whether edges are added bidirectionally. If set to /// `true` then for any edge `(u, v)` an edge `(v, u)` will also be added. /// If the graph is undirected this will result in a parallel edge. - +/// /// # Example /// ```rust /// use rustworkx_core::petgraph; diff --git a/rustworkx-core/src/token_swapper.rs b/rustworkx-core/src/token_swapper.rs index a982d35e7f..39695a58d6 100644 --- a/rustworkx-core/src/token_swapper.rs +++ b/rustworkx-core/src/token_swapper.rs @@ -437,7 +437,6 @@ where /// assert_eq!(3, output.len()); /// /// ``` - pub fn token_swapper( graph: G, mapping: HashMap, diff --git a/src/dag_algo/mod.rs b/src/dag_algo/mod.rs index 769582ce13..0adfff12a2 100644 --- a/src/dag_algo/mod.rs +++ b/src/dag_algo/mod.rs @@ -524,7 +524,7 @@ pub fn collect_runs( // This is where a filter function error will be returned, otherwise Result is stripped away let py_run: Vec = run_result? .iter() - .map(|node| return graph.graph.node_weight(*node).into_py(py)) + .map(|node| graph.graph.node_weight(*node).into_py(py)) .collect(); result.push(py_run) @@ -667,7 +667,7 @@ pub fn transitive_reduction( ); } } - return Ok(( + Ok(( digraph::PyDiGraph { graph: tr, node_removed: false, @@ -680,5 +680,5 @@ pub fn transitive_reduction( .iter() .map(|(k, v)| (k.index(), v.index())) .collect::>(), - )); + )) } diff --git a/src/digraph.rs b/src/digraph.rs index 07aa2be14a..47b70b93aa 100644 --- a/src/digraph.rs +++ b/src/digraph.rs @@ -200,7 +200,7 @@ impl GraphBase for PyDiGraph { type EdgeId = EdgeIndex; } -impl<'a> NodesRemoved for &'a PyDiGraph { +impl NodesRemoved for &PyDiGraph { fn nodes_removed(&self) -> bool { self.node_removed } @@ -886,7 +886,7 @@ impl PyDiGraph { /// /// :param int node_a: The index for the first node /// :param int node_b: The index for the second node - + /// /// :returns: A list with all the data objects for the edges between nodes /// :rtype: list /// :raises NoEdgeBetweenNodes: When there is no edge between nodes diff --git a/src/graph.rs b/src/graph.rs index f74933928b..c3e627e5ce 100644 --- a/src/graph.rs +++ b/src/graph.rs @@ -161,7 +161,7 @@ impl GraphBase for PyGraph { type EdgeId = EdgeIndex; } -impl<'a> NodesRemoved for &'a PyGraph { +impl NodesRemoved for &PyGraph { fn nodes_removed(&self) -> bool { self.node_removed } diff --git a/src/iterators.rs b/src/iterators.rs index 390aa39257..cabfbe1c37 100644 --- a/src/iterators.rs +++ b/src/iterators.rs @@ -282,7 +282,7 @@ where } } -impl<'py, T> PyEq> for T +impl PyEq> for T where for<'p> T: PyEq + Clone + FromPyObject<'p>, { @@ -1031,7 +1031,7 @@ impl PyHash for EdgeList { } } -impl<'py> PyEq> for EdgeList { +impl PyEq> for EdgeList { #[inline] fn eq(&self, other: &Bound, py: Python) -> PyResult { PyEq::eq(&self.edges, other, py) @@ -1119,7 +1119,7 @@ impl PyHash for IndexPartitionBlock { } } -impl<'py> PyEq> for IndexPartitionBlock { +impl PyEq> for IndexPartitionBlock { #[inline] fn eq(&self, other: &Bound, py: Python) -> PyResult { PyEq::eq(&self.block, other, py) @@ -1522,7 +1522,7 @@ impl PyHash for PathMapping { } } -impl<'py> PyEq> for PathMapping { +impl PyEq> for PathMapping { #[inline] fn eq(&self, other: &Bound, py: Python) -> PyResult { PyEq::eq(&self.paths, other, py) @@ -1686,7 +1686,7 @@ impl PyHash for MultiplePathMapping { } } -impl<'py> PyEq> for MultiplePathMapping { +impl PyEq> for MultiplePathMapping { #[inline] fn eq(&self, other: &Bound, py: Python) -> PyResult { PyEq::eq(&self.paths, other, py) @@ -1750,7 +1750,7 @@ impl PyHash for PathLengthMapping { } } -impl<'py> PyEq> for PathLengthMapping { +impl PyEq> for PathLengthMapping { #[inline] fn eq(&self, other: &Bound, py: Python) -> PyResult { PyEq::eq(&self.path_lengths, other, py) diff --git a/src/lib.rs b/src/lib.rs index 16c4214538..4ee4189a7b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -203,7 +203,7 @@ pub trait NodesRemoved { fn nodes_removed(&self) -> bool; } -impl<'a, Ty> NodesRemoved for &'a StablePyGraph +impl NodesRemoved for &StablePyGraph where Ty: EdgeType, {