Skip to content

Commit

Permalink
[#48828] Remove redundant casts
Browse files Browse the repository at this point in the history
  • Loading branch information
GPlaczek committed Sep 12, 2023
1 parent cf7c1c0 commit 86c6edc
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,9 @@ pub fn set_env(key: &str, val: Option<&str>) -> Result<(), ExitCode> {
let c_key = CString::new(key).unwrap();
match if let Some(v) = val {
let c_val = CString::new(v).unwrap();
unsafe {
wasi_ext_lib_generated::wasi_ext_set_env(
c_key.as_ptr() as *const i8,
c_val.as_ptr() as *const i8,
)
}
unsafe { wasi_ext_lib_generated::wasi_ext_set_env(c_key.as_ptr(), c_val.as_ptr()) }
} else {
unsafe {
wasi_ext_lib_generated::wasi_ext_set_env(c_key.as_ptr() as *const i8, ptr::null::<i8>())
}
unsafe { wasi_ext_lib_generated::wasi_ext_set_env(c_key.as_ptr(), ptr::null::<i8>()) }
} {
0 => Ok(()),
e => Err(e),
Expand Down

0 comments on commit 86c6edc

Please sign in to comment.