Skip to content

chore: fix some Clippy lints - #1068

Merged
Benoît Cortier (CBenoit) merged 13 commits into
Devolutions:masterfrom
allan2:clippy
Oct 25, 2024
Merged

Benoît Cortier (CBenoit) merged 13 commits into
Devolutions:masterfrom
allan2:clippy

Conversation

@allan2

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread devolutions-session/src/main.rs
@allan2

Copy link
Copy Markdown
Contributor Author

Ready for review. This PR fixes easy and non-ambiguous lints.

Remaining unfixed lints include:

  • unused_crate_dependencies
  • unreachable_pub - most warnings are in Agent; I assume more modules will be exported in the future
  • unused_qualifications - I did not replace std::mem::size_of/mem::size_of with size_of
  • clippy::as_underscore

More PRs to follow for the remaining ones.

Comment thread devolutions-session/src/dvc.rs Outdated
Comment thread devolutions-session/src/main.rs Outdated
@CBenoit

Benoît Cortier (CBenoit) commented Oct 25, 2024 •

Copy link
Copy Markdown
Member

Thank you!

* unused_crate_dependencies

If you want to address this one, let me know beforehand so we can discuss on how it should be approached.

* unreachable_pub - most warnings are in Agent; I assume more modules will be exported in the future

Actually, it’s probably a sign that the pub keyword should be removed, or pub(crate) should be used.
In some cases such a sealed traits, we actually want to silent this warning though.

* unused_qualifications - I did not replace `std::mem::size_of`/`mem::size_of` with `size_of`

For that one, in order of preference, I recommend: mem::size_of > std::mem::size_of > size_of

  • mem::size_of is the best readability and clarity overall
  • std::mem::size_of when the function is used only once
  • size_of when it is used a lot for doing arithmetic, I would then recommend a local import at the function level where it is used abundantly

That being said, those are just guidelines, and anything is acceptable :)

@allan2
Allan Zhang (allan2) requested review from a team as code owners October 25, 2024 07:03

@CBenoit Benoît Cortier (CBenoit) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I removed the duplicated commits from master:

tmpscrot

Maybe something wrong happened when you tried to rebase on top of master or merge master into your branch?

Otherwise, everything is looking good to me!

@CBenoit

Benoît Cortier (CBenoit) commented Oct 25, 2024 •

Copy link
Copy Markdown
Member

I reworded a bit your individual commits so we can merge rebase them without squashing everything. It mostly comes down to the fact that changing code without modifying the semantic is a "refactor", changes to doc only (including comments) should be "docs" and I added the scope when it made sense. It’s mostly relevant for features and bug fixes that are actually perceived by the end user as we have scripts looking for these commits when generating the changelog to avoid forgetting important changes. This is based on the conventional commit specification. All that said, I should document the details and how we are using it in the repository directly :)

@CBenoit
Benoît Cortier (CBenoit) merged commit 0af2779 into Devolutions:master Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants