@@ -236,6 +236,7 @@ impl<'a> Iterator for TagIter<'a> {
236236mod tests {
237237 use super :: * ;
238238 use crate :: test_util:: AlignedBytes ;
239+ use core:: borrow:: Borrow ;
239240 use core:: mem;
240241
241242 #[ test]
@@ -248,7 +249,7 @@ mod tests {
248249 0x13 , 0x37 , 0x13 , 0x37 ,
249250 ] ) ;
250251
251- let bytes = TagBytesRef :: try_from ( & bytes[ .. ] ) . unwrap ( ) ;
252+ let bytes = TagBytesRef :: try_from ( bytes. borrow ( ) ) . unwrap ( ) ;
252253 let tag = GenericTag :: ref_from ( bytes) ;
253254 assert_eq ! ( tag. header. typ, 0xffff_ffff ) ;
254255 assert_eq ! ( tag. header. size, 16 ) ;
@@ -277,7 +278,7 @@ mod tests {
277278 0xef , 0xbe , 0xad , 0xde , /* field b: 0x1337_1337 */
278279 0x37 , 0x13 , 0x37 , 0x13 ,
279280 ] ) ;
280- let bytes = TagBytesRef :: try_from ( & bytes[ .. ] ) . unwrap ( ) ;
281+ let bytes = TagBytesRef :: try_from ( bytes. borrow ( ) ) . unwrap ( ) ;
281282 let tag = GenericTag :: ref_from ( bytes) ;
282283 let custom_tag = tag. cast :: < CustomTag > ( ) ;
283284
@@ -313,7 +314,7 @@ mod tests {
313314 0x37 , 0x13 , 0x37 , 0x13 ,
314315 ] ) ;
315316
316- let bytes = TagBytesRef :: try_from ( & bytes[ .. ] ) . unwrap ( ) ;
317+ let bytes = TagBytesRef :: try_from ( bytes. borrow ( ) ) . unwrap ( ) ;
317318 let tag = GenericTag :: ref_from ( bytes) ;
318319 let custom_tag = tag. cast :: < CustomDstTag > ( ) ;
319320
@@ -369,7 +370,7 @@ mod tests {
369370 0 , 0 , 0 , 0 , 0 , 0
370371 ] ,
371372 ) ;
372- let bytes = TagBytesRef :: try_from ( & bytes[ .. ] ) . unwrap ( ) ;
373+ let bytes = TagBytesRef :: try_from ( bytes. borrow ( ) ) . unwrap ( ) ;
373374 let tag = GenericTag :: ref_from ( bytes) ;
374375 assert_eq ! ( tag. header. typ, TagType :: Cmdline ) ;
375376 assert_eq ! ( tag. header. size, 8 + 10 ) ;
@@ -391,7 +392,7 @@ mod tests {
391392 0 , 0 , 0 , 0 , 0 , 0
392393 ] ,
393394 ) ;
394- let bytes = TagBytesRef :: try_from ( & bytes[ .. ] ) . unwrap ( ) ;
395+ let bytes = TagBytesRef :: try_from ( bytes. borrow ( ) ) . unwrap ( ) ;
395396 let tag = GenericTag :: ref_from ( bytes) ;
396397
397398 // Main objective here is also that this test passes Miri.
@@ -419,7 +420,7 @@ mod tests {
419420 8 , 0 , 0 , 0 ,
420421 ] ,
421422 ) ;
422- let mut iter = TagIter :: new ( & bytes[ .. ] ) ;
423+ let mut iter = TagIter :: new ( bytes. borrow ( ) ) ;
423424 let first = iter. next ( ) . unwrap ( ) ;
424425 assert_eq ! ( first. header. typ, TagType :: Custom ( 0xff ) ) ;
425426 assert_eq ! ( first. header. size, 8 ) ;
0 commit comments