Skip to content

Fix clippy warnings breaking the master build #375

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

Closed
lshlyapnikov opened this issue Jan 4, 2023 · 0 comments
Closed

Fix clippy warnings breaking the master build #375

lshlyapnikov opened this issue Jan 4, 2023 · 0 comments

Comments

@lshlyapnikov
Copy link
Contributor

https://github.com/rust-lang/socket2/actions/runs/3759675926/jobs/6389525887

error: clamp-like pattern without using clamp function
   --> src/sys/unix.rs:650:5
    |
650 | /     if value <= min {
651 | |         min
652 | |     } else if value >= max {
653 | |         max
654 | |     } else {
655 | |         value
656 | |     }
    | |_____^ help: replace with clamp: `value.clamp(min, max)`
    |
    = note: clamp will panic if max < min
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_clamp
    = note: `-D clippy::manual-clamp` implied by `-D warnings`

error: casting to the same type is unnecessary (`usize` -> `usize`)
   --> src/sys/unix.rs:785:38
    |
785 |     msg.msg_iovlen = min(bufs.len(), IovLen::MAX as usize) as IovLen;
    |                                      ^^^^^^^^^^^^^^^^^^^^ help: try: `IovLen::MAX`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
    = note: `-D clippy::unnecessary-cast` implied by `-D warnings`

error: casting to the same type is unnecessary (`usize` -> `usize`)
   --> src/sys/unix.rs:845:38
    |
845 |     msg.msg_iovlen = min(bufs.len(), IovLen::MAX as usize) as IovLen;
    |                                      ^^^^^^^^^^^^^^^^^^^^ help: try: `IovLen::MAX`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

error: clamp-like pattern without using clamp function
   --> src/sys/unix.rs:650:5
    |
650 | /     if value <= min {
651 | |         min
652 | |     } else if value >= max {
653 | |         max
654 | |     } else {
655 | |         value
656 | |     }
    | |_____^ help: replace with clamp: `value.clamp(min, max)`
    |
    = note: clamp will panic if max < min
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_clamp
note: the lint level is defined here
   --> src/lib.rs:58:24
    |
58  | #![cfg_attr(test, deny(warnings))]
    |                        ^^^^^^^^
    = note: `#[deny(clippy::manual_clamp)]` implied by `#[deny(warnings)]`

error: casting to the same type is unnecessary (`usize` -> `usize`)
   --> src/sys/unix.rs:785:38
    |
785 |     msg.msg_iovlen = min(bufs.len(), IovLen::MAX as usize) as IovLen;
    |                                      ^^^^^^^^^^^^^^^^^^^^ help: try: `IovLen::MAX`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
    = note: `#[deny(clippy::unnecessary_cast)]` implied by `#[deny(warnings)]`

error: could not compile `socket2` due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `socket2` due to 3 previous errors
Error: Process completed with exit code 101.
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 a pull request may close this issue.

2 participants