-
Notifications
You must be signed in to change notification settings - Fork 131
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
Fix clippy lints #264
base: master
Are you sure you want to change the base?
Fix clippy lints #264
Conversation
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.
Looks generally good to me.
@@ -50,7 +50,7 @@ fn extend_with_write(b: &mut Bencher) { | |||
let data = [1; 512]; | |||
b.iter(|| { | |||
v.clear(); | |||
v.write(&data[..]).ok(); | |||
v.write_all(&data[..]).ok(); |
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.
This seems to change the benchmark, it now tests a different function.
/// This function is `unsafe` because it changes the notion of the | ||
/// number of “valid” bytes in the string. Use with care. | ||
/// # Safety | ||
/// The data must be initialised up to the length provided. |
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.
This seems to remove the old comment. Was it incorrect?
// guaranteed to fit due to types matching. | ||
self.clear(); | ||
self.try_push_str(rhs).ok(); | ||
} |
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.
Why was this removed?
/// This method is `unsafe` because it changes the notion of the | ||
/// number of “valid” elements in the vector. Use with care. | ||
/// # Safety | ||
/// The data must be initialised up to the length provided. |
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.
What was wrong about the old comment?
@@ -1013,7 +1018,7 @@ impl<'a, T: 'a, const CAP: usize> Drop for Drain<'a, T, CAP> { | |||
// len is currently 0 so panicking while dropping will not cause a double drop. | |||
|
|||
// exhaust self first | |||
while let Some(_) = self.next() { } | |||
for _ in self.by_ref() { } |
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.
I don't think this is more readable.
This fixes all the clippy lints firing for me which improves efficiency and helps new people work on the codebase.