Fix clippy lints

Fixes: #2926
This commit is contained in:
Wolfgang Silbermayr
2022-06-07 09:12:28 +02:00
parent 6c7ce0ba45
commit 5339f7cdae
119 changed files with 864 additions and 831 deletions

View File

@@ -122,7 +122,9 @@ pub unsafe fn copy_cstr_into_wasm(ctx: &EmEnv, cstr: *const c_char) -> u32 {
space_offset
}
pub unsafe fn allocate_on_stack<'a, T: Copy>(ctx: &'a EmEnv, count: u32) -> (u32, &'a mut [T]) {
/// # Safety
/// This method is unsafe because it operates directly with the slice of memory represented by the address
pub unsafe fn allocate_on_stack<T: Copy>(ctx: &EmEnv, count: u32) -> (u32, &mut [T]) {
let offset = get_emscripten_data(ctx)
.stack_alloc_ref()
.unwrap()
@@ -135,6 +137,8 @@ pub unsafe fn allocate_on_stack<'a, T: Copy>(ctx: &'a EmEnv, count: u32) -> (u32
(offset, slice)
}
/// # Safety
/// This method is unsafe because it uses `allocate_on_stack` which is unsafe
pub unsafe fn allocate_cstr_on_stack<'a>(ctx: &'a EmEnv, s: &str) -> (u32, &'a [u8]) {
let (offset, slice) = allocate_on_stack(ctx, (s.len() + 1) as u32);