Skip to content

Commit f54c9b2

Browse files
committed
Fix a couple of trivial clippy warnings
1 parent dc9ae5f commit f54c9b2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Diff for: cairo/src/svg.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,11 @@ mod test {
146146
*surface.finish_output_stream().unwrap().downcast().unwrap()
147147
}
148148

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

Diff for: glib/src/translate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ macro_rules! impl_to_glib_container_from_slice_fundamental {
958958
}
959959

960960
unsafe {
961-
let res = ffi::g_malloc(mem::size_of::<$name>() * t.len()) as *mut $name;
961+
let res = ffi::g_malloc(mem::size_of_val(t)) as *mut $name;
962962
ptr::copy_nonoverlapping(t.as_ptr(), res, t.len());
963963
res
964964
}

0 commit comments

Comments
 (0)