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

iterator::Dijkstra::get_distance() does not need &mut self #56

Open
cemeyer opened this issue Dec 9, 2021 · 0 comments
Open

iterator::Dijkstra::get_distance() does not need &mut self #56

cemeyer opened this issue Dec 9, 2021 · 0 comments

Comments

@cemeyer
Copy link

cemeyer commented Dec 9, 2021

It doesn't mutate self, so it could just take an immutable &self ref.

Also, it seems like get_path_to shouldn't need to consume self -- &mut self would be fine, and allow reusing the SSSP calculation without cloning the entire Dijkstra structure. But maybe I'm missing something.

cemeyer added a commit to cemeyer/graphlib that referenced this issue Dec 9, 2021
We only consume `self` for `iterator: VecDequeue`, which is unused
outside of this routine and might as well be a local variable.
cemeyer added a commit to cemeyer/graphlib that referenced this issue Dec 9, 2021
While here, drop an unnecessary bare `Option::unwrap()`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant