Skip to content

Commit

Permalink
Fix a couple of trivial clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sdroege committed Jun 6, 2023
1 parent dc9ae5f commit f54c9b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cairo/src/svg.rs
Expand Up @@ -146,10 +146,11 @@ mod test {
*surface.finish_output_stream().unwrap().downcast().unwrap()
}

#[track_caller]
fn assert_len_close_enough(len_a: usize, len_b: usize) {
// It seems cairo randomizes some element IDs which might make one svg slightly
// larger than the other. Here we make sure the difference is within ~10%.
let len_diff = (len_a as isize - len_b as isize).abs() as usize;
let len_diff = usize::abs_diff(len_a, len_b);
assert!(len_diff < len_b / 10);
}

Expand Down
2 changes: 1 addition & 1 deletion glib/src/translate.rs
Expand Up @@ -958,7 +958,7 @@ macro_rules! impl_to_glib_container_from_slice_fundamental {
}

unsafe {
let res = ffi::g_malloc(mem::size_of::<$name>() * t.len()) as *mut $name;
let res = ffi::g_malloc(mem::size_of_val(t)) as *mut $name;
ptr::copy_nonoverlapping(t.as_ptr(), res, t.len());
res
}
Expand Down

0 comments on commit f54c9b2

Please sign in to comment.