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 gh action and linting #531

Merged
merged 32 commits into from
Jul 22, 2024
Merged

fix: clippy gh action and linting #531

merged 32 commits into from
Jul 22, 2024

Conversation

yuroitaki
Copy link
Member

#373 introduced a change that caused GH clippy action to only run on examples folder but not anything else (can check the past CI logs, e.g. https://github.com/tlsnotary/tlsn/actions/runs/9755990843/job/26925478536)).

image

This PR fixes that by running clippy on all targets (binary, library, example, test, bench). Though since the components/tls/tls-client crate contains broken tests that don't compile, cargo hack is used temporarily to exclude the crate when running clippy in the components/tls workspace until the test is fixed.

Linting changes from applying clippy on the entire codebase are included too.

@@ -60,6 +60,7 @@ impl<Ctx: Context> MpcAesGcm<Ctx> {
}

#[async_trait]
#[allow(clippy::blocks_in_conditions)]
Copy link
Member Author

@yuroitaki yuroitaki Jul 4, 2024

Choose a reason for hiding this comment

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

this needs to be declared due to this upstream issue rust-lang/rust-clippy#12281 — we shall file a ticket to remove this declaration once the upstream fix is released

Copy link
Member

@themighty1 themighty1 left a comment

Choose a reason for hiding this comment

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

gw!

Copy link
Member

@sinui0 sinui0 left a comment

Choose a reason for hiding this comment

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

lgtm, just 1 issue

Comment on lines +145 to +146
if server_closed && client.plaintext_is_empty() && client.buffer_len().await? == 0 {
break 'conn;
Copy link
Member

Choose a reason for hiding this comment

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

we don't want to create the client.buffer_len() future unless the first two conditions are met.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

@th4s you're right! so we can follow clippy's advice actually @sinui0 :)

@yuroitaki yuroitaki requested a review from th4s July 16, 2024 14:13
Copy link
Member

@sinui0 sinui0 left a comment

Choose a reason for hiding this comment

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

lgtm, just 1 change

Copy link
Member

Choose a reason for hiding this comment

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

The simpler solution to this is to just add #[allow(clippy::all)] at in the lib.rs of the tls client crate

@@ -89,6 +89,7 @@ impl<C, Ctx> Debug for Ghash<C, Ctx> {
}

#[async_trait]
#[allow(clippy::blocks_in_conditions)]
Copy link
Member

Choose a reason for hiding this comment

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

Is this lint here needed? I remember that this was/is some sort of clippy bug.

@sinui0 sinui0 requested a review from th4s July 22, 2024 03:18
@sinui0 sinui0 merged commit 7377eaf into dev Jul 22, 2024
14 checks passed
@sinui0 sinui0 deleted the fix/gh-clippy-action branch July 22, 2024 03:44
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.

4 participants