diff --git a/src/leb128.rs b/src/leb128.rs index eceec6d..e6490c6 100644 --- a/src/leb128.rs +++ b/src/leb128.rs @@ -184,7 +184,7 @@ mod tests { let bytes = &buf[..]; let num = bytes.pread::(0).unwrap(); #[cfg(feature = "std")] - println!("num: {num:?}"); + println!("num: {:?}", &num); assert_eq!(130u64, num.into()); assert_eq!(num.size(), 2); @@ -192,7 +192,7 @@ mod tests { let bytes = &buf[..]; let num = bytes.pread::(0).unwrap(); #[cfg(feature = "std")] - println!("num: {num:?}"); + println!("num: {:?}", &num); assert_eq!(0u64, num.into()); assert_eq!(num.size(), 1); @@ -200,7 +200,7 @@ mod tests { let bytes = &buf[..]; let num = bytes.pread::(0).unwrap(); #[cfg(feature = "std")] - println!("num: {num:?}"); + println!("num: {:?}", &num); assert_eq!(0x21u64, num.into()); assert_eq!(num.size(), 1); } diff --git a/src/lib.rs b/src/lib.rs index 0198a70..eedaca7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -358,22 +358,22 @@ mod tests { let b = &bytes[..]; let s: &str = b.pread(0).unwrap(); #[cfg(feature = "std")] - println!("str: {s}"); + println!("str: {}", s); assert_eq!(s.len(), bytes[..].len() - 1); let bytes: &[u8] = b"hello, world!\0some_other_things"; let hello_world: &str = bytes.pread_with(0, StrCtx::Delimiter(NULL)).unwrap(); #[cfg(feature = "std")] - println!("{hello_world:?}"); + println!("{:?}", &hello_world); assert_eq!(hello_world.len(), 13); let hello: &str = bytes.pread_with(0, StrCtx::Delimiter(SPACE)).unwrap(); #[cfg(feature = "std")] - println!("{hello:?}"); + println!("{:?}", &hello); assert_eq!(hello.len(), 6); // this could result in underflow so we just try it let _error = bytes.pread_with::<&str>(6, StrCtx::Delimiter(SPACE)); let error = bytes.pread_with::<&str>(7, StrCtx::Delimiter(SPACE)); #[cfg(feature = "std")] - println!("{error:?}"); + println!("{:?}", &error); assert!(error.is_ok()); } @@ -383,14 +383,16 @@ mod tests { use super::Pread; let bytes: &[u8] = b""; let hello_world = bytes.pread_with::<&str>(0, StrCtx::Delimiter(NULL)); + #[cfg(feature = "std")] println!("1 {:?}", &hello_world); assert!(hello_world.is_err()); let error = bytes.pread_with::<&str>(7, StrCtx::Delimiter(SPACE)); #[cfg(feature = "std")] - println!("2 {error:?}"); + println!("2 {:?}", &error); assert!(error.is_err()); let bytes: &[u8] = b"\0"; let null = bytes.pread::<&str>(0).unwrap(); + #[cfg(feature = "std")] println!("3 {:?}", &null); assert!(null.is_empty()); } @@ -619,9 +621,10 @@ mod tests { let astring: [u8; 3] = [0x45, 0x2a, 0x44]; let string = astring.gread_with::<&str>(offset, StrCtx::Length(2)); match &string { - &Ok(_) => {} - Err(err) => { - println!("{}", &err); + Ok(_) => {} + Err(_err) => { + #[cfg(feature = "std")] + println!("{_err}"); panic!(); } }