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 new clippy lints #2429

Merged
merged 1 commit into from
Apr 19, 2024
Merged

Conversation

ljedrz
Copy link
Collaborator

@ljedrz ljedrz commented Apr 8, 2024

These pop up either when using some specific bits of snarkVM as a dependency or just start being detected in 1.77; regardless, they seem to be innocuous.

I found them by accident when using snarkVM as a dependency in a small benchmark binary.

@@ -186,7 +186,7 @@ impl<N: Network> RegisterTypes<N> {
for operand in async_.operands() {
if let Operand::Register(register) = operand {
if let Ok(RegisterType::Future(locator)) = register_types.get_type(stack, register) {
assert!(future_registers.remove(&(register.clone(), locator)));
assert!(future_registers.swap_remove(&(register.clone(), locator)));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we do want swap_remove here, because right after this loop we ensure that the future_registers is empty, meaning the order is no longer significant

Copy link
Member

Choose a reason for hiding this comment

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

@d0cd @evan-schott can you confirm swap_remove is the intended behavior? (i understand it was technically swap_remove, want to ensure it truly shouldn't be shift_remove)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Confirmed that swap_remove is intended since we do not rely on the order of future_registers after the removes are done.

@@ -80,7 +80,7 @@ pub trait FromBytes {
}
}

pub struct ToBytesSerializer<T: ToBytes>(String, Option<usize>, PhantomData<T>);
pub struct ToBytesSerializer<T: ToBytes>(PhantomData<T>);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you maybe share intuition or the clippy lint which led to these suggestions? The change ot FromBytesVisitor makes sense but for ToBytesSerializer and FromBytesDeserializer I don't see why we can remove those elements "for free" and why we put them there in the first place.

Copy link
Collaborator Author

@ljedrz ljedrz Apr 9, 2024

Choose a reason for hiding this comment

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

clippy just stated that they are never used - I'm not sure why they were put there in the first place either (presumably some feature that was never added in the end), but everything still compiles just fine without them.

@howardwu howardwu requested review from d0cd and evan-schott April 11, 2024 22:31
@howardwu howardwu merged commit 85a62a8 into ProvableHQ:mainnet-staging Apr 19, 2024
80 checks passed
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.

5 participants