You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's a lot of error-related boilerplate which in the end doesn't do much other than just print out a single message. I'd suggest to use the crate anyhow, which would make this a lot less boilerplate, nicer to look at and faster to add new errors.
Another thing I noticed is the usage of ? in situations where an Error should absolutely impossible as seen here:
I think just unwraping here would be the better choice to signal the impossibility of failing and to be 100% sure to be noticed when it fails, cause then probably something went terrible wrong.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
There's a lot of error-related boilerplate which in the end doesn't do much other than just print out a single message. I'd suggest to use the crate anyhow, which would make this a lot less boilerplate, nicer to look at and faster to add new errors.
Another thing I noticed is the usage of
?
in situations where an Error should absolutely impossible as seen here:rust-music-theory/src/scale/scale.rs
Lines 40 to 44 in 7cff5d6
I think just
unwrap
ing here would be the better choice to signal the impossibility of failing and to be 100% sure to be noticed when it fails, cause then probably something went terrible wrong.Beta Was this translation helpful? Give feedback.
All reactions