Wulf / create-rust-app

Set up a modern rust+react web app by running one command.
https://create-rust-app.dev
Apache License 2.0
1.54k stars 63 forks source link

minor refactoring and fixes: dev module #373

Closed AnthonyMichaelTDM closed 5 months ago

AnthonyMichaelTDM commented 6 months ago

4 commits, details as follows:

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.

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

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

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.