1818//! let hex_string = hex::encode("Hello world!");
1919//!
2020//! println!("{}", hex_string); // Prints "48656c6c6f20776f726c6421"
21+ //!
2122//! # assert_eq!(hex_string, "48656c6c6f20776f726c6421");
2223//! ```
2324
2425#![ doc( html_root_url = "https://docs.rs/hex/0.4.1" ) ]
2526#![ cfg_attr( not( feature = "std" ) , no_std) ]
2627#![ cfg_attr( docsrs, feature( doc_cfg) ) ]
2728#![ allow( clippy:: unreadable_literal) ]
28- #![ warn( clippy:: use_self) ]
2929
3030#[ cfg( not( feature = "std" ) ) ]
3131extern crate alloc;
@@ -35,7 +35,7 @@ use alloc::{string::String, vec::Vec};
3535use core:: iter;
3636
3737mod error;
38- pub use error:: FromHexError ;
38+ pub use crate :: error:: FromHexError ;
3939
4040#[ cfg( feature = "serde" ) ]
4141#[ cfg_attr( docsrs, doc( cfg( feature = "serde" ) ) ) ]
@@ -350,11 +350,7 @@ pub fn encode_to_slice<T: AsRef<[u8]>>(input: T, output: &mut [u8]) -> Result<()
350350 return Err ( FromHexError :: InvalidStringLength ) ;
351351 }
352352
353- for ( byte, ( i, j) ) in input
354- . as_ref ( )
355- . iter ( )
356- . zip ( generate_iter ( input. as_ref ( ) . len ( ) * 2 ) )
357- {
353+ for ( byte, ( i, j) ) in input. as_ref ( ) . iter ( ) . zip ( generate_iter ( input. as_ref ( ) . len ( ) * 2 ) ) {
358354 let ( high, low) = byte2hex ( * byte, HEX_CHARS_LOWER ) ;
359355 output[ i] = high;
360356 output[ j] = low;
@@ -409,10 +405,7 @@ mod test {
409405
410406 let mut output_3 = [ 0 ; 4 ] ;
411407
412- assert_eq ! (
413- decode_to_slice( b"6" , & mut output_3) ,
414- Err ( FromHexError :: OddLength )
415- ) ;
408+ assert_eq ! ( decode_to_slice( b"6" , & mut output_3) , Err ( FromHexError :: OddLength ) ) ;
416409 }
417410
418411 #[ test]
@@ -422,10 +415,7 @@ mod test {
422415
423416 #[ test]
424417 fn test_decode ( ) {
425- assert_eq ! (
426- decode( "666f6f626172" ) ,
427- Ok ( String :: from( "foobar" ) . into_bytes( ) )
428- ) ;
418+ assert_eq ! ( decode( "666f6f626172" ) , Ok ( String :: from( "foobar" ) . into_bytes( ) ) ) ;
429419 }
430420
431421 #[ test]
@@ -443,10 +433,7 @@ mod test {
443433 #[ test]
444434 pub fn test_invalid_length ( ) {
445435 assert_eq ! ( Vec :: from_hex( "1" ) . unwrap_err( ) , FromHexError :: OddLength ) ;
446- assert_eq ! (
447- Vec :: from_hex( "666f6f6261721" ) . unwrap_err( ) ,
448- FromHexError :: OddLength
449- ) ;
436+ assert_eq ! ( Vec :: from_hex( "666f6f6261721" ) . unwrap_err( ) , FromHexError :: OddLength ) ;
450437 }
451438
452439 #[ test]
0 commit comments