Merge pull request #390 from dave-tucker/clippy-up

clippy: Fix latest nightly lints
pull/391/head
Michal Rostecki 2 years ago committed by GitHub
commit 367ab20305
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -53,7 +53,7 @@ use std::{
fmt::{LowerHex, UpperHex},
io, mem,
net::{Ipv4Addr, Ipv6Addr},
ptr, slice, str,
ptr, str,
sync::Arc,
};
@ -412,10 +412,11 @@ fn log_buf(mut buf: &[u8], logger: &dyn Log) -> Result<(), ()> {
full_log_msg.push_str(&value.format(last_hint.take())?);
}
Argument::ArrU16Len8 => {
let ptr = attr.value.as_ptr().cast::<u16>();
let slice = unsafe { slice::from_raw_parts(ptr, 8) };
let data: [u8; 16] = attr.value.try_into().map_err(|_| ())?;
let mut value: [u16; 8] = Default::default();
value.copy_from_slice(slice);
for (i, s) in data.chunks_exact(2).enumerate() {
value[i] = ((s[1] as u16) << 8) | s[0] as u16;
}
full_log_msg.push_str(&value.format(last_hint.take())?);
}
Argument::Str => match str::from_utf8(attr.value) {

@ -81,7 +81,7 @@ fn build_rust_ebpf(opts: &Options) -> anyhow::Result<()> {
fn get_libbpf_headers<P: AsRef<Path>>(libbpf_dir: P, include_path: P) -> anyhow::Result<()> {
let dir = include_path.as_ref();
fs::create_dir_all(&dir)?;
fs::create_dir_all(dir)?;
let status = Command::new("make")
.current_dir(libbpf_dir.as_ref().join("src"))
.arg(format!("INCLUDEDIR={}", dir.as_os_str().to_string_lossy()))

@ -55,7 +55,7 @@ pub fn docs() -> Result<(), anyhow::Error> {
fn build_docs(working_dir: &PathBuf, abs_header_path: &Path) -> Result<(), anyhow::Error> {
let replace = Command::new("sed")
.current_dir(&working_dir)
.current_dir(working_dir)
.args(vec!["-i.bak", "s/crabby.svg/crabby_dev.svg/", "src/lib.rs"])
.status()
.expect("failed to replace logo");
@ -64,7 +64,7 @@ fn build_docs(working_dir: &PathBuf, abs_header_path: &Path) -> Result<(), anyho
let args = vec!["+nightly", "doc", "--no-deps", "--all-features"];
let status = Command::new("cargo")
.current_dir(&working_dir)
.current_dir(working_dir)
.env(
"RUSTDOCFLAGS",
format!("--html-in-header {}", abs_header_path.to_str().unwrap()),

Loading…
Cancel
Save