devolutions-gateway icon indicating copy to clipboard operation
devolutions-gateway copied to clipboard

unused_qualification lint warnings

Open allan2 opened this issue 1 year ago • 1 comments

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 avatar Oct 25 '24 07:10 allan2

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 :+1:

CBenoit avatar Oct 25 '24 07:10 CBenoit