206
206
clippy:: dbg_macro,
207
207
clippy:: decimal_literal_representation,
208
208
clippy:: double_must_use,
209
+ clippy:: expect_used,
209
210
clippy:: get_unwrap,
210
211
clippy:: indexing_slicing,
211
212
clippy:: missing_inline_in_public_items,
248
249
// production code introduce the possibly of code panicking unexpectedly "in
249
250
// the field".
250
251
clippy:: arithmetic_side_effects,
252
+ clippy:: expect_used,
251
253
clippy:: indexing_slicing,
252
254
) ) ]
253
255
#![ cfg_attr( not( test) , no_std) ]
@@ -1874,6 +1876,7 @@ pub unsafe trait FromZeros: TryFromBytes {
1874
1876
#[ must_use = "has no side effects (other than allocation)" ]
1875
1877
#[ cfg( feature = "alloc" ) ]
1876
1878
#[ cfg_attr( doc_cfg, doc( cfg( feature = "alloc" ) ) ) ]
1879
+ #[ allow( clippy:: expect_used) ]
1877
1880
#[ inline]
1878
1881
fn new_box_slice_zeroed ( len : usize ) -> Box < [ Self ] >
1879
1882
where
@@ -3313,10 +3316,7 @@ pub unsafe trait IntoBytes {
3313
3316
Self : NoCell ,
3314
3317
{
3315
3318
let start = bytes. len ( ) . checked_sub ( mem:: size_of_val ( self ) ) ?;
3316
- bytes
3317
- . get_mut ( start..)
3318
- . expect ( "`start` should be in-bounds of `bytes`" )
3319
- . copy_from_slice ( self . as_bytes ( ) ) ;
3319
+ bytes. get_mut ( start..) ?. copy_from_slice ( self . as_bytes ( ) ) ;
3320
3320
Some ( ( ) )
3321
3321
}
3322
3322
@@ -5445,6 +5445,7 @@ where
5445
5445
pub fn into_ref ( self ) -> & ' a T {
5446
5446
// PANICS: By invariant on `Ref`, `self.0`'s size and alignment are
5447
5447
// valid for `T`, and so this `unwrap` will not panic.
5448
+ #[ allow( clippy:: expect_used) ]
5448
5449
let ptr = Ptr :: from_ref ( self . 0 . into ( ) )
5449
5450
. try_cast_into_no_leftover :: < T > ( )
5450
5451
. expect ( "zerocopy internal error: into_ref should be infallible" ) ;
@@ -5466,6 +5467,7 @@ where
5466
5467
pub fn into_mut ( self ) -> & ' a mut T {
5467
5468
// PANICS: By invariant on `Ref`, `self.0`'s size and alignment are
5468
5469
// valid for `T`, and so this `unwrap` will not panic.
5470
+ #[ allow( clippy:: expect_used) ]
5469
5471
let ptr = Ptr :: from_mut ( self . 0 . into ( ) )
5470
5472
. try_cast_into_no_leftover :: < T > ( )
5471
5473
. expect ( "zerocopy internal error: into_ref should be infallible" ) ;
@@ -5546,6 +5548,7 @@ where
5546
5548
fn deref ( & self ) -> & T {
5547
5549
// PANICS: By invariant on `Ref`, `self.0`'s size and alignment are
5548
5550
// valid for `T`, and so this `unwrap` will not panic.
5551
+ #[ allow( clippy:: expect_used) ]
5549
5552
let ptr = Ptr :: from_ref ( self . 0 . deref ( ) )
5550
5553
. try_cast_into_no_leftover :: < T > ( )
5551
5554
. expect ( "zerocopy internal error: Deref::deref should be infallible" ) ;
@@ -5563,6 +5566,7 @@ where
5563
5566
fn deref_mut ( & mut self ) -> & mut T {
5564
5567
// PANICS: By invariant on `Ref`, `self.0`'s size and alignment are
5565
5568
// valid for `T`, and so this `unwrap` will not panic.
5569
+ #[ allow( clippy:: expect_used) ]
5566
5570
let ptr = Ptr :: from_mut ( self . 0 . deref_mut ( ) )
5567
5571
. try_cast_into_no_leftover :: < T > ( )
5568
5572
. expect ( "zerocopy internal error: DerefMut::deref_mut should be infallible" ) ;
0 commit comments