-
Notifications
You must be signed in to change notification settings - Fork 307
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
NonZero start #647
NonZero start #647
Conversation
The particular error provided in your comment is a result of something like the following (based on my understanding of the compiler's type inference):
To fix this error at the call site, you can specify the type of the step with e.g. My recommendation would be to initially leave the public API as-is (e.g. with |
I've made an effort at an MVP - let me know your thoughts. It does change a Beyond that, there aren't that many places to use NonZero that aren't public. In my very limited experience, it's also not that ergonomic, so I wouldn't suggest rushing to add it to public APIs |
Tests pass, except for #676 |
@@ -130,7 +133,6 @@ impl SliceOrIndex { | |||
/// (This method checks with a debug assertion that `step` is not zero.) | |||
#[inline] | |||
pub fn step_by(self, step: isize) -> Self { | |||
debug_assert_ne!(step, 0, "SliceOrIndex::step_by: step must be nonzero"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I don't think this should be removed yet; I'll add back post-review
# Conflicts: # .travis.yml
Hi, a formality, I've lifted up and bolded my instruction from the new rust features issue:
In short it's not a laundry list, and we only use the features if they gain us something. The pull request should formulate what the goal and the gain of the change is. Hope that makes sense. (If I should continue to rant as a person with maintainer experience, I hope goal and gain is a part of every pull request's description! For me, code doesn't speak for itself, and everyone has different places they are coming from.) |
Closing as stale; thanks for the feedback @jturner314 & @bluss last year |
I started attempting to implement NonZero from #558
But I was tripping over from the get-go - am I going in the right direction here?
As well as the errors I'd expect to see (e.g. from direct struct construction), I'm also seeing errors like these:
Any guidance would be appreciated!