memgraph / rsmgclient

Memgraph database adapter for Rust programming language.
https://crates.io/crates/rsmgclient
Apache License 2.0
38 stars 6 forks source link

Remove unnecessary panic for unreachable code #26

Closed dejankos closed 3 years ago

dejankos commented 3 years ago

This PR removes unnecessary panic for unreachable code and unifies behavior for lazy and eager data fetching.

Although std::unreachable!() could be used here and serve as self explanatory there is no reason for keeping this behavior in a lib API that returns a Result type.

Test is rewritten since as far as I can see it was just a c/p where no data was fetched in loop but code would panic on first fetchone fn invocations since result was explicitly set to None.

gitbuda commented 3 years ago

@dejankos Nice! I'll check the code a bit later but overall seems reasonable. Thank you!! :1st_place_medal:

gitbuda commented 3 years ago

cargo fmt changed the two suggestions, so please apply them if that makes sense. As soon as that gets fixed, the PR is ready to be merged.

There is a failing test: Screenshot from 2021-04-27 06-18-39 But I've noticed that a couple of days ago, I think it's nothing related to this change. There has to be another PR fixing that.

dejankos commented 3 years ago

@gitbuda Ah yes sorry about fmt, changes accepted. For that test since attributes size is asserted instead of attribute names I can only guess it's related to running Memgraph version.