Open
Description
I tried this code:
let cmsg_len = match usize::try_from(hdr.cmsg_len) {
Ok(l) => l,
_ => return einval(),
};
I expected to see this happen: Nothing, as cmsg_len
is u32
on many platforms.
Instead, this happened:
warning: useless conversion to the same type: `usize`
--> uapi/src/socket/cmsg.rs:71:26
|
71 | let cmsg_len = match usize::try_from(hdr.cmsg_len) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider removing `usize::try_from()`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
Meta
cargo clippy -V
: clippy 0.0.212 (7eac88a 2020-11-16)rustc -Vv
:rustc 1.48.0 (7eac88abb 2020-11-16) binary: rustc commit-hash: 7eac88abb2e57e752f3302f02be5f3ce3d7adfb4 commit-date: 2020-11-16 host: x86_64-unknown-linux-gnu release: 1.48.0 LLVM version: 11.0