Skip to content

Commit

Permalink
Fix Clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
kylewlacy committed Dec 16, 2024
1 parent d8cd13d commit b84c818
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions crates/brioche-packed-userland-exec/src/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn run(args: &[&CStr], env_vars: &[&CStr]) -> Result<(), PackedError> {
let mut exec = userland_execve::ExecOptions::new(&interpreter);

let interpreter =
<[u8]>::from_path(&interpreter).ok_or_else(|| PackedError::InvalidPath)?;
<[u8]>::from_path(&interpreter).ok_or(PackedError::InvalidPath)?;
let interpreter = CString::new(interpreter).map_err(|_| PackedError::InvalidPath)?;

let mut resolved_library_dirs = vec![];
Expand Down Expand Up @@ -110,20 +110,20 @@ fn run(args: &[&CStr], env_vars: &[&CStr]) -> Result<(), PackedError> {
}

let path =
<[u8]>::from_path(library_dir).ok_or_else(|| PackedError::InvalidPath)?;
<[u8]>::from_path(library_dir).ok_or(PackedError::InvalidPath)?;
ld_library_path.extend(path);
}

if let Some(env_library_path) = std::env::var_os("LD_LIBRARY_PATH") {
let env_library_path = <[u8]>::from_os_str(&env_library_path)
.ok_or_else(|| PackedError::InvalidPath)?;
.ok_or(PackedError::InvalidPath)?;
if !env_library_path.is_empty() {
ld_library_path.push(b':');
ld_library_path.extend(env_library_path);
}
}

exec.arg(CStr::from_bytes_with_nul(b"--library-path\0").unwrap());
exec.arg(c"--library-path");

let ld_library_path =
CString::new(ld_library_path).map_err(|_| PackedError::InvalidPath)?;
Expand All @@ -132,11 +132,11 @@ fn run(args: &[&CStr], env_vars: &[&CStr]) -> Result<(), PackedError> {

let mut args = args.iter();
if let Some(arg0) = args.next() {
exec.arg(CStr::from_bytes_with_nul(b"--argv0\0").unwrap());
exec.arg(c"--argv0");
exec.arg(arg0);
}

let program = <[u8]>::from_path(&program).ok_or_else(|| PackedError::InvalidPath)?;
let program = <[u8]>::from_path(&program).ok_or(PackedError::InvalidPath)?;
let program = CString::new(program).map_err(|_| PackedError::InvalidPath)?;
exec.arg(program);

Expand Down

0 comments on commit b84c818

Please sign in to comment.