File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1211,17 +1211,13 @@ where
12111211}
12121212
12131213/// Generate a [`TryFromSliceError`] if the slice doesn't match the given length.
1214- #[ cfg_attr( debug_assertions, allow( clippy:: panic_in_result_fn) ) ]
12151214fn check_slice_length < T , U : ArraySize > ( slice : & [ T ] ) -> Result < ( ) , TryFromSliceError > {
12161215 debug_assert_eq ! ( Array :: <( ) , U >:: default ( ) . len( ) , U :: USIZE ) ;
12171216
1218- if slice. len ( ) != U :: USIZE {
1219- // Hack: `TryFromSliceError` lacks a public constructor
1220- <& [ T ; 1 ] >:: try_from ( [ ] . as_slice ( ) ) ?;
1221-
1222- #[ cfg( debug_assertions) ]
1223- unreachable ! ( ) ;
1217+ if slice. len ( ) == U :: USIZE {
1218+ Ok ( ( ) )
1219+ } else {
1220+ // Hack: `TryFromSliceError` lacks a public constructor, so this fakes one
1221+ <& [ T ; 1 ] >:: try_from ( [ ] . as_slice ( ) ) . map ( |_| ( ) )
12241222 }
1225-
1226- Ok ( ( ) )
12271223}
You can’t perform that action at this time.
0 commit comments