File tree 2 files changed +3
-2
lines changed
2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -146,10 +146,11 @@ mod test {
146
146
* surface. finish_output_stream ( ) . unwrap ( ) . downcast ( ) . unwrap ( )
147
147
}
148
148
149
+ #[ track_caller]
149
150
fn assert_len_close_enough ( len_a : usize , len_b : usize ) {
150
151
// It seems cairo randomizes some element IDs which might make one svg slightly
151
152
// 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) ;
153
154
assert ! ( len_diff < len_b / 10 ) ;
154
155
}
155
156
Original file line number Diff line number Diff line change @@ -958,7 +958,7 @@ macro_rules! impl_to_glib_container_from_slice_fundamental {
958
958
}
959
959
960
960
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;
962
962
ptr:: copy_nonoverlapping( t. as_ptr( ) , res, t. len( ) ) ;
963
963
res
964
964
}
You can’t perform that action at this time.
0 commit comments