Skip to content

add support for OpenBSD/pf (#1567) #1212

add support for OpenBSD/pf (#1567)

add support for OpenBSD/pf (#1567) #1212

GitHub Actions / clippy macos-latest succeeded Sep 19, 2024 in 0s

clippy macos-latest

9 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 9
Note 0
Help 0

Versions

  • rustc 1.81.0 (eeb90cda1 2024-09-04)
  • cargo 1.81.0 (2dbb1af80 2024-08-20)
  • clippy 0.1.81 (eeb90cda 2024-09-04)

Annotations

Check warning on line 172 in crates/shadowsocks-service/src/local/tun/tcp.rs

See this annotation in the file changed.

@github-actions github-actions / clippy macos-latest

transmute used without annotations

warning: transmute used without annotations
   --> crates/shadowsocks-service/src/local/tun/tcp.rs:172:38
    |
172 |         let recv_buf = unsafe { mem::transmute::<_, &mut [u8]>(buf.unfilled_mut()) };
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider adding missing annotations: `transmute::<&mut [std::mem::MaybeUninit<u8>], &mut [u8]>`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_transmute_annotations
    = note: `#[warn(clippy::missing_transmute_annotations)]` on by default

Check warning on line 117 in crates/shadowsocks-service/src/local/socks/server/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy macos-latest

unnecessary closure used to substitute value for `Option::None`

warning: unnecessary closure used to substitute value for `Option::None`
   --> crates/shadowsocks-service/src/local/socks/server/mod.rs:114:46
    |
114 |           let udp_associate_addr: ServerAddr = self
    |  ______________________________________________^
115 | |             .udp_associate_addr
116 | |             .as_ref()
117 | |             .or_else(|| self.udp_bind_addr.as_ref())
    | |______________--------------------------------------^
    |                |
    |                help: use `or(..)` instead: `or(self.udp_bind_addr.as_ref())`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations

Check warning on line 118 in crates/shadowsocks-service/src/local/socks/server/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy macos-latest

unnecessary closure used to substitute value for `Option::None`

warning: unnecessary closure used to substitute value for `Option::None`
   --> crates/shadowsocks-service/src/local/socks/server/mod.rs:114:46
    |
114 |           let udp_associate_addr: ServerAddr = self
    |  ______________________________________________^
115 | |             .udp_associate_addr
116 | |             .as_ref()
117 | |             .or_else(|| self.udp_bind_addr.as_ref())
118 | |             .unwrap_or_else(|| &self.client_config)
    | |______________-------------------------------------^
    |                |
    |                help: use `unwrap_or(..)` instead: `unwrap_or(&self.client_config)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
    = note: `#[warn(clippy::unnecessary_lazy_evaluations)]` on by default

Check warning on line 66 in crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/macos.rs

See this annotation in the file changed.

@github-actions github-actions / clippy macos-latest

this `match` can be collapsed into the outer `if let`

warning: this `match` can be collapsed into the outer `if let`
  --> crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/macos.rs:58:21
   |
58 | /                     match errno {
59 | |                         libc::ENOPROTOOPT => {
60 | |                             trace!("failed to set SO_REUSEPORT, error: {}", err);
61 | |                         }
...  |
65 | |                         }
66 | |                     }
   | |_____________________^
   |
help: the outer pattern can be modified to include the inner pattern
  --> crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/macos.rs:57:29
   |
57 |                 if let Some(errno) = err.raw_os_error() {
   |                             ^^^^^ replace this binding
58 |                     match errno {
59 |                         libc::ENOPROTOOPT => {
   |                         ^^^^^^^^^^^^^^^^^ with this pattern
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_match
   = note: `#[warn(clippy::collapsible_match)]` on by default

Check warning on line 191 in crates/shadowsocks-service/src/local/loadbalancing/server_stat.rs

See this annotation in the file changed.

@github-actions github-actions / clippy macos-latest

casting the result of `i32::abs()` to u32

warning: casting the result of `i32::abs()` to u32
   --> crates/shadowsocks-service/src/local/loadbalancing/server_stat.rs:191:30
    |
191 |                     .map(|s| (*s as i32 - self.data.latency_median as i32).abs() as u32)
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `(*s as i32 - self.data.latency_median as i32).unsigned_abs()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_abs_to_unsigned
    = note: `#[warn(clippy::cast_abs_to_unsigned)]` on by default

Check warning on line 69 in crates/shadowsocks-service/src/local/loadbalancing/server_data.rs

See this annotation in the file changed.

@github-actions github-actions / clippy macos-latest

using `clone` on type `ServerStatData` which implements the `Copy` trait

warning: using `clone` on type `ServerStatData` which implements the `Copy` trait
  --> crates/shadowsocks-service/src/local/loadbalancing/server_data.rs:69:9
   |
69 |         self.stat_data.lock().await.data().clone()
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*self.stat_data.lock().await.data()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

Check warning on line 56 in crates/shadowsocks-service/src/local/loadbalancing/server_data.rs

See this annotation in the file changed.

@github-actions github-actions / clippy macos-latest

using `clone` on type `ServerStatData` which implements the `Copy` trait

warning: using `clone` on type `ServerStatData` which implements the `Copy` trait
  --> crates/shadowsocks-service/src/local/loadbalancing/server_data.rs:56:38
   |
56 |             (stat.push_score(score), stat.data().clone())
   |                                      ^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*stat.data()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
   = note: `#[warn(clippy::clone_on_copy)]` on by default

Check warning on line 919 in crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs

See this annotation in the file changed.

@github-actions github-actions / clippy macos-latest

redundant pattern matching, consider using `is_ok()`

warning: redundant pattern matching, consider using `is_ok()`
   --> crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:919:16
    |
919 |         if let Ok(..) = response.parse(&buf) {
    |         -------^^^^^^----------------------- help: try: `if response.parse(&buf).is_ok()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching

Check warning on line 878 in crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs

See this annotation in the file changed.

@github-actions github-actions / clippy macos-latest

redundant pattern matching, consider using `is_ok()`

warning: redundant pattern matching, consider using `is_ok()`
   --> crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:878:16
    |
878 |         if let Ok(..) = response.parse(&buf) {
    |         -------^^^^^^----------------------- help: try: `if response.parse(&buf).is_ok()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
    = note: `#[warn(clippy::redundant_pattern_matching)]` on by default