Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Clean up some clippy warnings#277

Merged
lann merged 2 commits intobytecodealliance:mainfrom
dfoxfranke:main
May 10, 2024
Merged

Clean up some clippy warnings#277
lann merged 2 commits intobytecodealliance:mainfrom
dfoxfranke:main

Conversation

@dfoxfranke
Copy link
Copy Markdown
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.
let mut record: operator::OperatorRecord = e_data.contents.try_into().unwrap();

record.prev = last.clone();
record.prev.clone_from(last);
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.


#[derive(Queryable)]
#[diesel(table_name = checkpoints)]
#[allow(dead_code)]
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@lann
Copy link
Copy Markdown
Collaborator

lann commented May 10, 2024

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants