-
Notifications
You must be signed in to change notification settings - Fork 38
Improve clippy linting situation #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
hkBst
left a comment
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.
LGTM except for a few minor things.
|
As noted in #60, I can compile |
152d35e to
7e7f407
Compare
|
@nicoburns Sorted out the MSRV, the CI failures, and hkBst's comments. |
| _len: SizeType, | ||
| _cap: SizeType, | ||
| len: SizeType, | ||
| cap: SizeType, |
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.
Given that this crate is designed to support FFI with an equivalent vectors type in Gecko's C++ code, I think we may need to keep the field names as they were. It's probably possible to change them here with an change to Gecko's bindgen code, but also probably not worth the bother?
Can we just ignore this lint?
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.
No need to do this, the names are already different in Gecko.
| final_size as usize | ||
| final_size | ||
| .try_into() | ||
| .expect("cannot allocate object larger than isize") |
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.
Use of try_into for these casts seems like it could cause a perf regression? Which seems a bit unnecessary given that we can be confident that they will always succeed.
Do you have a motivation for changing them other than that the lint says to?
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.
Yeah I'd leave these casts as they are.
| _len: SizeType, | ||
| _cap: SizeType, | ||
| len: SizeType, | ||
| cap: SizeType, |
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.
No need to do this, the names are already different in Gecko.
| final_size as usize | ||
| final_size | ||
| .try_into() | ||
| .expect("cannot allocate object larger than isize") |
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.
Yeah I'd leave these casts as they are.
| /// ``` | ||
| pub fn dedup(&mut self) { | ||
| self.dedup_by(|a, b| a == b) | ||
| self.dedup_by(|a, b| a == b); |
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.
These changes also feel pretty random.
|
Would be good to split this PR (or the commits at least) in formatting changes, then style changes (which shouldn't have perf impact) then others. |
|
Okay, I don't have the free time for now to work on that. Anyone is free to take up the mantle either from scratch or based on this PR. |
Currently some warn-by-default lints fire in the tests, this PR fixes up the existing warnings, then adds pedantic and some nursery lints in for good luck.