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

Clean up some clippy warnings #277

Merged
merged 2 commits into from
May 10, 2024
Merged

Clean up some clippy warnings #277

merged 2 commits into from
May 10, 2024

Conversation

dfoxfranke
Copy link
Contributor

Remove some unused imports, use clone_from where appropriate, allow unread fields on a Postgres-related structure, and fix a #[cfg(feature = ...)] referencing a non-existent feature.

There is one "real" change here which is that the visit_byte_buf method
was previously dead code because the "alloc" feature was not defined
(and the crate depends unconditionally on std). Instead of deleting the
method I removed the conditional so that the method will be included.
@@ -39,7 +39,7 @@ fn validate_input(input: Vec<EnvelopeData>) -> Result<LogState> {
let key = signing::PrivateKey::decode(e_data.key.clone()).unwrap();
let mut record: operator::OperatorRecord = e_data.contents.try_into().unwrap();

record.prev = last.clone();
record.prev.clone_from(last);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was surprised that clippy would recommend a readability regression like this and it looks like I am not alone: rust-lang/rust-clippy#12778

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to disable the lint rather than make this change?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eh, given its just in tests its probably fine to leave this PR as-is.

@@ -91,6 +91,7 @@ pub struct NewCheckpoint<'a> {

#[derive(Queryable)]
#[diesel(table_name = checkpoints)]
#[allow(dead_code)]
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 marked dead here? I'm surprised anything in a #[derive(Queryable)] would be...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The timestamp fields. The query fills them in, but nothing reads them.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah I guess Queryable would be read-only wouldn't it? 👍

@lann lann merged commit 8f226a4 into bytecodealliance:main May 10, 2024
6 checks passed
@lann
Copy link
Collaborator

lann commented May 10, 2024

Thanks!

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.

None yet

2 participants