fn check_printer<TPrint>(printer: TPrint, left: &str, right: &str, expected: &str)
    where
        TPrint: Fn(&mut String, &str, &str) -> fmt::Result,
    {
        let mut actual = String::new();
        printer(&mut actual, left, right).expect("printer function failed");

        // Cannot use IO without stdlib
        #[cfg(feature = "std")]
        println!(
            "## left ##\n\
             {}\n\
             ## right ##\n\
             {}\n\
             ## actual diff ##\n\
             {}\n\
             ## expected diff ##\n\
             {}",
            left, right, actual, expected
        );
        assert_eq!(actual, expected);
    }
/// Given that both of our diff printing functions have the same
/// type signature, we can reuse the same test code for them.
///
/// This could probably be nicer with traits!
Given that both of our diff printing functions have the same
type signature, we can reuse the same test code for them.

This could probably be nicer with traits!
Given that both of our diff printing functions have the same type signature we can reuse the same test code for them . This could probably be nicer with traits!
fn check_printer<TPrint>(printer: TPrint, left: &str, right: &str, expected: &str)
    where
        TPrint: Fn(&mut String, &str, &str) -> fmt::Result,
    {
        let mut actual = String::new();
        printer(&mut actual, left, right).expect("printer function failed");
        // Cannot use IO without stdlib
        #[cfg(feature = "std")]
        println!(
            "## left ##\n\
             {}\n\
             ## right ##\n\
             {}\n\
             ## actual diff ##\n\
             {}\n\
             ## expected diff ##\n\
             {}",
            left, right, actual, expected
        );
        assert_eq!(actual, expected);
    }
fn check_printer < TPrint > ( printer : TPrint , left : & str , right : & str , expected : & str ) where TPrint : Fn ( & mut String , & str , & str ) -> fmt :: Result , { let mut actual = String :: new ( ) ; printer ( & mut actual , left , right ) . expect ( " " ) ; // Cannot use IO without stdlib # [ cfg ( feature " " ) ] println ! ( " \n \
 \n \
 \n \
 \n \
 \n \
 \n \
 \n \
 " left right actual expected ) ; assert_eq ! ( actual expected ) ; }
Given that both of our diff printing functions have the same
type signature, we can reuse the same test code for them.
Given that both of our diff printing functions have the same type signature we can reuse the same test code for them .
printer
TPrint
left
&str
right
&str
expected
&str
printer
TPrint
left
&str
right
&str
expected
&str