Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix clippy lints #264

wants to merge 1 commit into from

Conversation

GnomedDev
Copy link

This fixes all the clippy lints firing for me which improves efficiency and helps new people work on the codebase.

Copy link
Collaborator

@tbu- tbu- left a 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();
Copy link
Collaborator

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.
Copy link
Collaborator

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();
}
Copy link
Collaborator

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.
Copy link
Collaborator

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() { }
Copy link
Collaborator

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.

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

Successfully merging this pull request may close these issues.

2 participants