refactor: replace uses of 'crate::util::zip' with 'core::iter::zip'#849
refactor: replace uses of 'crate::util::zip' with 'core::iter::zip'#849RaoulLuque merged 1 commit intopetgraph:masterfrom
Conversation
The function 'zip' was introduced in petgraph#747 as a part of adding `no_std` support. However, there is already such a function in `core::iter`. The MSRV stated in the description of petgraph#747 was 1.64 at minimum, but the function in `core` is stable since Rust 1.59. Thus, it is an unnecessary duplication and can be removed without consequences.
|
There is, unfortunately, no |
|
LGTM 👍 Let's see what the tests say :) |
I see, what would be your idea then on how to get rid of the |
Removing the
I would implement the third option, i.e. moving it to wherever it fits best, and delete that file in my PR. BONUS OPTION: open an issue on the rustlang repository to add it to the core lib. It feels like a fairly useful function with really no maintenance to include it. If |
The file `util.rs` contained only a single helper function for use in
the `graph_impl` module. This commit changes four (and only four) small
things to remove this file:
1. add a replacement helper function to `src/graph_impl/mod.rs`
2. point `src/graph_impl/mod.rs` and its submodule
`src/graph_impl/stable_graph/mod.rs` to use the new function.
3. remove the `mod util;` line from the crate root.
4. remove the `src/util.rs` file from the repository.
Refs: petgraph#849
|
Done! It's actually a fairly tiny change, because the Given how infrequent of a pattern this actually was, you should consider just I have renamed the PR to reflect this second change. |
util.rs file, because it is redundant
|
I see, thanks for the explanation :) I think I'd also lean towards just removing the helper function altogether and just |
|
@RaoulLuque Do you want me remove the helper function in this PR, or would you a prefer a second PR to do so? |
|
As you wish, I'd say :) But if you split it into two, I would reduce this one to simply introducing the |
|
Ok. I think I will do two PRs then! Thanks for your fast and in-detail feedback! I'll try getting this PR done today, but I might take a few days to start on the second. |
|
This PR should not include the more recent command anymore and be just the replacing of Have a nice evening! |
util.rs file, because it is redundant|
Okay, great, thanks a lot :) |
|
I think the title was reversed, so I switched it up ^^ Side note: Just noticed, you're also from RWTH :) |
…etgraph#849) The function 'zip' was introduced in petgraph#747 as a part of adding `no_std` support. However, there is already such a function in `core::iter`. The MSRV stated in the description of petgraph#747 was 1.64 at minimum, but the function in `core` is stable since Rust 1.59. Thus, it is an unnecessary duplication and can be removed without consequences. <!-- -- Thanks for contributing to `petgraph`! -- -- We require PR titles to follow the Conventional Commits specification, -- https://www.conventionalcommits.org/en/v1.0.0/. This helps us generate -- changelogs and follow semantic versioning. -- -- Start the PR title with one of the following: -- * `feat:` for new features -- * `fix:` for bug fixes -- * `refactor:` for code refactors -- * `docs:` for documentation changes -- * `test:` for test changes -- * `perf:` for performance improvements -- * `revert:` for reverting changes -- * `ci:` for CI/CD changes -- * `chore:` for changes that don't fit in any of the above categories -- The last two categories will not be included in the changelog. -- -- If your PR includes a breaking change, please add a `!` after the type -- and include a `BREAKING CHANGE:` line in the body of the PR describing -- the necessary changes for users to update their code. -- --> Co-authored-by: cactusdualcore <[email protected]>
This was discussed in an earlier PR and removes `util.rs` and the `enumerate` function in that file. Refs: petgraph#849
The second PR is #872 |
…etgraph#849) The function 'zip' was introduced in petgraph#747 as a part of adding `no_std` support. However, there is already such a function in `core::iter`. The MSRV stated in the description of petgraph#747 was 1.64 at minimum, but the function in `core` is stable since Rust 1.59. Thus, it is an unnecessary duplication and can be removed without consequences. <!-- -- Thanks for contributing to `petgraph`! -- -- We require PR titles to follow the Conventional Commits specification, -- https://www.conventionalcommits.org/en/v1.0.0/. This helps us generate -- changelogs and follow semantic versioning. -- -- Start the PR title with one of the following: -- * `feat:` for new features -- * `fix:` for bug fixes -- * `refactor:` for code refactors -- * `docs:` for documentation changes -- * `test:` for test changes -- * `perf:` for performance improvements -- * `revert:` for reverting changes -- * `ci:` for CI/CD changes -- * `chore:` for changes that don't fit in any of the above categories -- The last two categories will not be included in the changelog. -- -- If your PR includes a breaking change, please add a `!` after the type -- and include a `BREAKING CHANGE:` line in the body of the PR describing -- the necessary changes for users to update their code. -- --> Co-authored-by: cactusdualcore <[email protected]>
This was discussed in an earlier PR and removes `util.rs` and the `enumerate` function in that file. Refs: petgraph#849
## 🤖 New release * `petgraph`: 0.8.2 -> 0.8.3 (✓ API compatible changes) <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [0.8.3](https://github.com/petgraph/petgraph/compare/[email protected]@v0.8.3) - 2025-09-28 ### Bug Fixes - Infinite `subgraph_isomorphisms_iter` for empty isomorphisms ([#780](#780)) - Algos don't work on `UndirectedAdaptor` ([#870](#870)) ([#871](#871)) - use a queue for SPFA ([#893](#893)) - `StableGraph::reverse` breaks free lists ([#890](#890)) ### Documentation - Fix examples link in README and unify typesetting of one word ([#823](#823)) - Add link to multigraph definition to isomorphism algos ([#824](#824)) - Fix auxiliary space (and time) complexity of bron-kerbosch ([#825](#825)) - Fix Typo in Operator Module Documentation ([#831](#831)) - Sync the crate feature flags in the README and docs ([#832](#832)) - Remove all \[Generic\] tags from algo docstrings ([#835](#835)) - Fix typos in comments ([#836](#836)) - Revamp CONTRIBUTING.md ([#833](#833)) - Update `GraphMap` link in README ([#857](#857)) - Add doc comment for `Dot::with_attr_getters` ([#850](#850)) - Specify iteration order for neighbors and edges and their variants ([#790](#790)) - Collection of Doc fixes ([#856](#856)) ### New Features - Add `into_nodes_edges_iters` to `StableGraph` ([#841](#841)) - Add methods to reserve & shrink `StableGraph` capacity ([#846](#846)) - Add Dinic's Maximum Flow Algorithm ([#739](#739)) - make Csr::from_sorted_edges generic over edge type and properly increase edge_count in Csr::from_sorted_edges ([#861](#861)) - Add `map_owned` and `filter_map_owned` for `Graph` and `StableGraph` ([#863](#863)) - Add dijkstra::with_dynamic_goal ([#855](#855)) - Fix self-loop bug in all_simple_paths and enable multiple targets ([#865](#865)) - mark petgraph::dot::Dot::graph_fmt as public ([#866](#866)) - Add bidirectional Dijkstra algorithm ([#782](#782)) ### Performance - Make A* tie break on lower h-values ([#882](#882)) ### Refactor - add examples for scc algorithms and reorganize into dedicated module ([#830](#830)) - Remove unnecessary trait bounds from impls/methods ([#828](#828)) - replace uses of 'crate::util::zip' with 'core::iter::zip' ([#849](#849)) - Fix clippy (and other) lints ([#851](#851)) - Cleanup repo ([#854](#854)) - replace crate::util::enumerate with Iterator::enumerate ([#881](#881)) ### Testing - Add dependency list for 'quickcheck' feature ([#822](#822)) - Fix feature cfg capitalization in doctest ([#852](#852)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Egor Starovoitov <[email protected]>
The function 'zip' was introduced in #747 as a part of adding
no_stdsupport. However, there is already such a function incore::iter. The MSRV stated in the description of #747 was 1.64 at minimum, but the function incoreis stable since Rust 1.59. Thus, it is an unnecessary duplication and can be removed without consequences.