fn assert_output(source: &Path, expected_filename: &Path) {
    let config = read_config(source);
    let (_, source_file, _) = format_file(source, config.clone());

    // Populate output by writing to a vec.
    let mut out = vec![];
    let _ = source_file::write_all_files(&source_file, &mut out, &config);
    let output = String::from_utf8(out).unwrap();

    let mut expected_file = fs::File::open(&expected_filename).expect("couldn't open target");
    let mut expected_text = String::new();
    expected_file
        .read_to_string(&mut expected_text)
        .expect("Failed reading target");

    let compare = make_diff(&expected_text, &output, DIFF_CONTEXT_SIZE);
    if !compare.is_empty() {
        let mut failures = HashMap::new();
        failures.insert(source.to_owned(), compare);
        print_mismatches_default_message(failures);
        assert!(false, "Text does not match expected output");
    }
}
// Helper function for comparing the results of rustfmt
// to a known output file generated by one of the write modes.
Helper function for comparing the results of rustfmt
to a known output file generated by one of the write modes.
Helper function for comparing the results of rustfmt to a known output file generated by one of the write modes .
fn assert_output(source: &Path, expected_filename: &Path) {
    let config = read_config(source);
    let (_, source_file, _) = format_file(source, config.clone());
    // Populate output by writing to a vec.
    let mut out = vec![];
    let _ = source_file::write_all_files(&source_file, &mut out, &config);
    let output = String::from_utf8(out).unwrap();
    let mut expected_file = fs::File::open(&expected_filename).expect("couldn't open target");
    let mut expected_text = String::new();
    expected_file
        .read_to_string(&mut expected_text)
        .expect("Failed reading target");
    let compare = make_diff(&expected_text, &output, DIFF_CONTEXT_SIZE);
    if !compare.is_empty() {
        let mut failures = HashMap::new();
        failures.insert(source.to_owned(), compare);
        print_mismatches_default_message(failures);
        assert!(false, "Text does not match expected output");
    }
}
fn assert_output ( source : & Path , expected_filename : & Path ) { let config = read_config ( source ) ; let ( _ , source_file , _ ) = format_file ( source , config . clone ( ) ) ; // Populate output by writing to a vec. let mut out = vec ! [ ] ; let _ = source_file :: write_all_files ( & source_file , & mut out , & config ) ; let output = String :: from_utf8 ( out ) . unwrap ( ) ; let mut expected_file = fs :: File :: open ( & expected_filename ) . expect ( " " ) ; let mut expected_text = String :: new ( ) ; expected_file . read_to_string ( & mut expected_text ) . expect ( " " ) ; let compare = make_diff ( & expected_text , & output , DIFF_CONTEXT_SIZE ) ; if ! compare . is_empty ( ) { let mut failures = HashMap :: new ( ) ; failures . insert ( source . to_owned ( ) , compare ) ; print_mismatches_default_message ( failures ) ; assert ! ( false " " ) ; } }
Helper function for comparing the results of rustfmt
to a known output file generated by one of the write modes.
Helper function for comparing the results of rustfmt to a known output file generated by one of the write modes .
source
&Path
expected_filename
&Path
source
&Path
expected_filename
&Path