Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clippy fails on Rust 1.83 #1331

Closed
airwoodix opened this issue Nov 29, 2024 · 0 comments · Fixed by #1332
Closed

Clippy fails on Rust 1.83 #1331

airwoodix opened this issue Nov 29, 2024 · 0 comments · Fixed by #1332
Labels
bug Something isn't working

Comments

@airwoodix
Copy link
Contributor

airwoodix commented Nov 29, 2024

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:

@airwoodix airwoodix added the bug Something isn't working label Nov 29, 2024
airwoodix added a commit to airwoodix/rustworkx that referenced this issue Nov 29, 2024
github-merge-queue bot pushed a commit that referenced this issue Nov 30, 2024
* core/steiner_tree: fix rustdoc warnings

* core/generators/dorogovtsev_goltsev_mendes: fix rustdoc warnings

* core/centrality: fix rustdoc warnings

* workflows/main: error on warnings during rustworkx-core doc build

* Pin Rust to 1.82 for clippy

* Revert: Pin Rust to 1.82 to work around #1331

This reverts commit 1977f66.

---------

Co-authored-by: Ivan Carvalho <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant