Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

Code Review #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Code Review #1

wants to merge 7 commits into from

Conversation

Stebalien
Copy link

I've reviewed your program as a series of commits (comments in the commit
messages). Feel free to discard this PR when you've read them (or merge it if you want but that's obviously up to you).

It's not perfect but it helps make things a bit more rustic.
Rust is pretty good at this and will tell you when it can't do it for
you.
It's more idiomatic (slices are built into the language itself).
First `a == b` desugars to `PartialEq::eq(&a, &b)`. Second, `&a`
autoderefs as needed to get the right type (it first tries `&a`, then
`&*a`, then `&**a` etc.).
Unlike languages like Java, rust can infer your types and will do so as
long as they don't appear in signatures. You can state them explicitly
but it usually adds more noise than it's worth.
When you actually want to display strings, there's no point in using the
debug formatter. Also, I figured I show of a cool use of match :).
Otherwise, they can make breaking changes and break your program. This
is less of an issue with binary packages because you check in Cargo.lock
but is still a good idea.

The rule is:

If the library is version 0.0.z, use 0.0.z (the full version).
If the library is version 0.y.z, use 0.y (allow patch releases).
If the library is version x.y.z, use x (no breaking changes) or x.y (no new features).
@Stebalien
Copy link
Author

Github isn't the best way to look at these. I recommend git log -p.

@k0pernicus
Copy link
Owner

Hi Stebalien!

Thanks a lot for this pull request - I am very impressed by your propositions! :-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants