Skip to content

Clippy fails on Rust 1.83 #1331

Closed
Closed
@airwoodix

Description

@airwoodix

Information

  • rustworkx version: 37bee6f
  • Rust version: 1.83

What is the current behavior?

cargo clippy fails:

    Checking rustworkx-core v0.16.0 (/home/etienne/code/github/rustworkx/rustworkx-core)
warning: empty line after doc comment
  --> rustworkx-core/src/generators/star_graph.rs:36:1
   |
36 | / ///     If the graph is undirected this will result in a parallel edge.
37 | |
   | |_
...
59 | / pub fn star_graph<G, T, F, H, M>(
60 | |     num_nodes: Option<usize>,
61 | |     weights: Option<Vec<T>>,
62 | |     mut default_node_weight: F,
...  |
69 | |     F: FnMut() -> T,
70 | |     H: FnMut() -> M,
   | |____________________- the comment documents this function
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments
   = note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default
   = help: if the empty line is unintentional remove it
help: if the documentation should include the empty line include it in the comment
   |
37 | ///
   |

warning: empty line after doc comment
   --> rustworkx-core/src/token_swapper.rs:439:1
    |
439 | / /// ```
440 | |
    | |_
441 | / pub fn token_swapper<G>(
442 | |     graph: G,
443 | |     mapping: HashMap<G::NodeId, G::NodeId>,
444 | |     trials: Option<usize>,
...   |
457 | |         + Sync,
458 | |     G::NodeId: Hash + Eq + Send + Sync,
    | |_______________________________________- the comment documents this function
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments
    = help: if the empty line is unintentional remove it

warning: `rustworkx-core` (lib) generated 2 warnings
    Checking rustworkx v0.16.0 (/home/etienne/code/github/rustworkx)
warning: unneeded `return` statement
   --> src/dag_algo/mod.rs:527:25
    |
527 |             .map(|node| return graph.graph.node_weight(*node).into_py(py))
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
    |
527 |             .map(|node| graph.graph.node_weight(*node).into_py(py))
    |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

warning: unneeded `return` statement
   --> src/dag_algo/mod.rs:670:5
    |
670 | /     return Ok((
671 | |         digraph::PyDiGraph {
672 | |             graph: tr,
673 | |             node_removed: false,
...   |
682 | |             .collect::<DictMap<usize, usize>>(),
683 | |     ));
    | |______^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
670 ~     Ok((
671 +         digraph::PyDiGraph {
672 +             graph: tr,
673 +             node_removed: false,
674 +             multigraph: graph.multigraph,
675 +             attrs: py.None(),
676 +             cycle_state: algo::DfsSpace::default(),
677 +             check_cycle: graph.check_cycle,
678 +         },
679 +         index_map
680 +             .iter()
681 +             .map(|(k, v)| (k.index(), v.index()))
682 +             .collect::<DictMap<usize, usize>>(),
683 ~     ))
    |

warning: the following explicit lifetimes could be elided: 'a
   --> src/digraph.rs:203:6
    |
203 | impl<'a> NodesRemoved for &'a PyDiGraph {
    |      ^^                    ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    = note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
    |
203 - impl<'a> NodesRemoved for &'a PyDiGraph {
203 + impl NodesRemoved for &PyDiGraph {
    |

warning: empty line after outer attribute
   --> src/digraph.rs:888:5
    |
888 | /     /// :param int node_b: The index for the second node
889 | |
    | |_
...
894 |       pub fn get_all_edge_data(&self, node_a: usize, node_b: usize) -> PyResult<Vec<&PyObject>> {
    |       ----------------------------------------------------------------------------------------- the attribute applies to this method
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_outer_attr
    = note: `#[warn(clippy::empty_line_after_outer_attr)]` on by default
    = help: if the empty line is unintentional remove it

warning: the following explicit lifetimes could be elided: 'a
   --> src/graph.rs:164:6
    |
164 | impl<'a> NodesRemoved for &'a PyGraph {
    |      ^^                    ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
    |
164 - impl<'a> NodesRemoved for &'a PyGraph {
164 + impl NodesRemoved for &PyGraph {
    |

warning: the following explicit lifetimes could be elided: 'py
   --> src/iterators.rs:285:6
    |
285 | impl<'py, T> PyEq<Bound<'py, PyAny>> for T
    |      ^^^                ^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
    |
285 - impl<'py, T> PyEq<Bound<'py, PyAny>> for T
285 + impl<T> PyEq<Bound<'_, PyAny>> for T
    |

warning: the following explicit lifetimes could be elided: 'py
    --> src/iterators.rs:1034:6
     |
1034 | impl<'py> PyEq<Bound<'py, PyAny>> for EdgeList {
     |      ^^^             ^^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
     |
1034 - impl<'py> PyEq<Bound<'py, PyAny>> for EdgeList {
1034 + impl PyEq<Bound<'_, PyAny>> for EdgeList {
     |

warning: the following explicit lifetimes could be elided: 'py
    --> src/iterators.rs:1122:6
     |
1122 | impl<'py> PyEq<Bound<'py, PyAny>> for IndexPartitionBlock {
     |      ^^^             ^^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
     |
1122 - impl<'py> PyEq<Bound<'py, PyAny>> for IndexPartitionBlock {
1122 + impl PyEq<Bound<'_, PyAny>> for IndexPartitionBlock {
     |

warning: the following explicit lifetimes could be elided: 'py
    --> src/iterators.rs:1525:6
     |
1525 | impl<'py> PyEq<Bound<'py, PyAny>> for PathMapping {
     |      ^^^             ^^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
     |
1525 - impl<'py> PyEq<Bound<'py, PyAny>> for PathMapping {
1525 + impl PyEq<Bound<'_, PyAny>> for PathMapping {
     |

warning: the following explicit lifetimes could be elided: 'py
    --> src/iterators.rs:1689:6
     |
1689 | impl<'py> PyEq<Bound<'py, PyAny>> for MultiplePathMapping {
     |      ^^^             ^^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
     |
1689 - impl<'py> PyEq<Bound<'py, PyAny>> for MultiplePathMapping {
1689 + impl PyEq<Bound<'_, PyAny>> for MultiplePathMapping {
     |

warning: the following explicit lifetimes could be elided: 'py
    --> src/iterators.rs:1753:6
     |
1753 | impl<'py> PyEq<Bound<'py, PyAny>> for PathLengthMapping {
     |      ^^^             ^^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
     |
1753 - impl<'py> PyEq<Bound<'py, PyAny>> for PathLengthMapping {
1753 + impl PyEq<Bound<'_, PyAny>> for PathLengthMapping {
     |

warning: the following explicit lifetimes could be elided: 'a
   --> src/lib.rs:206:6
    |
206 | impl<'a, Ty> NodesRemoved for &'a StablePyGraph<Ty>
    |      ^^                        ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
    |
206 - impl<'a, Ty> NodesRemoved for &'a StablePyGraph<Ty>
206 + impl<Ty> NodesRemoved for &StablePyGraph<Ty>
    |

warning: `rustworkx` (lib) generated 12 warnings (run `cargo clippy --fix --lib -p rustworkx` to apply 11 suggestions)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 9.96s

Since the CI jobs workflow specifies stable as channel, new runs automatically use 1.83 (stable since 2024-11-28) and thus fail (see e.g. this run).

Upstream changes:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions