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

minor refactoring and fixes: dev module #373

Merged
merged 4 commits into from
May 12, 2024

Conversation

AnthonyMichaelTDM
Copy link
Collaborator

4 commits, details as follows:

  • fix(dev): don't panic in is_connected if we couldn't get a connection to the db

it doesn't make sense for a failed connection to panic in a function that's supposed to check for a connection, this fixes that (probably) unintended behavior.

  • perf: assigning the result of Clone::clone() may be inefficient

https://rust-lang.github.io/rust-clippy/master/index.html#/assigning_clones
using clone_from let's us avoid unnecessary allocations

  • refactor(dev): migrate_db fn to return result instead of ( success, optional error_message ) tuple.

We aren't in Go, we have better error handling available so should take advantage of it

TODO: There are more cases in this function where it may be better to propagate errors rather than panicing

  • refactor(dev): listen_for_signals, rename variables and refactor error handling

https://rust-lang.github.io/rust-clippy/master/index.html#/never_loop

the loop only actually runs once, so an if let is a much more clear expression.

…ptional error_message ) tuple.

We aren't in Go, we have better error handling available so should take advantage of it

TODO: There are more cases in this function where it may be better to propagate errors rather than panicing
…r handling

https://rust-lang.github.io/rust-clippy/master/index.html#/never_loop

the loop only actually runs once, so an `if let` is a much more clear expression.
@AnthonyMichaelTDM AnthonyMichaelTDM merged commit 5d1a0cb into Wulf:main May 12, 2024
6 checks passed
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

Successfully merging this pull request may close these issues.

2 participants