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

unused_qualification lint warnings #1071

Open
allan2 opened this issue Oct 25, 2024 · 1 comment
Open

unused_qualification lint warnings #1071

allan2 opened this issue Oct 25, 2024 · 1 comment
Assignees

Comments

@allan2
Copy link
Contributor

allan2 commented Oct 25, 2024

When running Clippy, there are lots of warnings like

warning: unnecessary qualification
   --> crates\win-api-wrappers\src\thread.rs:175:54
    |
175 |             ThreadAttributeType::ParentProcess(_) => mem::size_of::<HANDLE>(),
    |                                                      ^^^^^^^^^^^^^^^^^^^^^^
    |
help: remove the unnecessary path segments
    |
175 -             ThreadAttributeType::ParentProcess(_) => mem::size_of::<HANDLE>(),
175 +             ThreadAttributeType::ParentProcess(_) => size_of::<HANDLE>(),

std::mem::size_of and mem::size_of both fail this lint.

I suggest removing the lint if the maintainers prefer to use mem::size_of, or to accept the lint suggestion, i.e., unqualified size_of.

I can make a PR for this pending guidance.

#1068 related

@allan2 allan2 self-assigned this Oct 25, 2024
@CBenoit
Copy link
Member

CBenoit commented Oct 25, 2024

I just discovered that size_of was part of the std prelude: https://doc.rust-lang.org/std/prelude/index.html#prelude-contents
For this reason, you can forget what I said here about the guidelines, and just use size_of unqualified. If it’s in the prelude, let’s just use it as-is 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants