bpf: fix some clippy warnings

pull/29/head
Alessandro Decina 3 years ago
parent 1159741eda
commit 5dfd27dbd0

@ -1,9 +1,9 @@
use std::env;
fn main() {
if !env::var("CARGO_CFG_BPF_TARGET_ARCH").is_ok() {
if env::var("CARGO_CFG_BPF_TARGET_ARCH").is_err() {
let arch = env::var("HOST").unwrap();
let arch = arch.splitn(2, "-").next().unwrap();
let arch = arch.splitn(2, '-').next().unwrap();
println!("cargo:rustc-cfg=bpf_target_arch=\"{}\"", arch);
}
}

@ -1,9 +1,9 @@
use std::env;
fn main() {
if !env::var("CARGO_CFG_BPF_TARGET_ARCH").is_ok() {
if env::var("CARGO_CFG_BPF_TARGET_ARCH").is_err() {
let arch = env::var("HOST").unwrap();
let arch = arch.splitn(2, "-").next().unwrap();
let arch = arch.splitn(2, '-').next().unwrap();
println!("cargo:rustc-cfg=bpf_target_arch=\"{}\"", arch);
}
}

@ -226,8 +226,8 @@ impl CgroupSkb {
Ok(CgroupSkb {
item,
name,
expected_attach_type,
name,
})
}
@ -260,7 +260,7 @@ fn pop_arg(args: &mut Args, name: &str) -> Option<String> {
}
fn err_on_unknown_args(args: &Args) -> Result<()> {
for arg in &args.args {
if let Some(arg) = args.args.get(0) {
return Err(Error::new_spanned(&arg.name, "invalid argument"));
}

@ -36,7 +36,7 @@ impl SkSkbContext {
}
#[inline]
pub fn cb_mut(&self) -> &mut [u32] {
pub fn cb_mut(&mut self) -> &mut [u32] {
unsafe { &mut (*self.skb).cb }
}

Loading…
Cancel
Save