fn report_error(
    inspect: &str,
    config: &Vec<&str>,
    rc: i32,
    substring: &str,
    should_output: bool,
) -> bool {
    match run_command(inspect, config) {
        Ok(output) => {
            let stdout =
                std::str::from_utf8(&output.stdout).unwrap_or("Non-UTF8 return from command");
            if output.status.code() == Some(rc) {
                if stdout.contains(substring) == should_output {
                    return false;
                } else {
                    if should_output {
                        println!(
                            "Output of {} and {:?} did not contain '{}':\n'{}'\n",
                            inspect, config, substring, stdout
                        );
                    } else {
                        println!(
                            "Output of {} and {:?} wrongly contained '{}':\n'{}'\n",
                            inspect, config, substring, stdout
                        );
                    }
                }
            } else {
                println!(
                    "Bad return code {:?} (expected {}) from {} and {:?}; output:\n'{}'\n",
                    output.status.code(),
                    rc,
                    inspect,
                    config,
                    stdout
                );
            }
        }
        Err(e) => {
            println!("Command with {} and {:?} failed to run: {}", inspect, config, e);
        }
    }
    return true;
}
// If there's an error, print a summary and return true; otherwise, false.
If there's an error, print a summary and return true; otherwise, false.
If there ' s an error print a summary and return true ; otherwise false .
fn report_error(
    inspect: &str,
    config: &Vec<&str>,
    rc: i32,
    substring: &str,
    should_output: bool,
) -> bool {
    match run_command(inspect, config) {
        Ok(output) => {
            let stdout =
                std::str::from_utf8(&output.stdout).unwrap_or("Non-UTF8 return from command");
            if output.status.code() == Some(rc) {
                if stdout.contains(substring) == should_output {
                    return false;
                } else {
                    if should_output {
                        println!(
                            "Output of {} and {:?} did not contain '{}':\n'{}'\n",
                            inspect, config, substring, stdout
                        );
                    } else {
                        println!(
                            "Output of {} and {:?} wrongly contained '{}':\n'{}'\n",
                            inspect, config, substring, stdout
                        );
                    }
                }
            } else {
                println!(
                    "Bad return code {:?} (expected {}) from {} and {:?}; output:\n'{}'\n",
                    output.status.code(),
                    rc,
                    inspect,
                    config,
                    stdout
                );
            }
        }
        Err(e) => {
            println!("Command with {} and {:?} failed to run: {}", inspect, config, e);
        }
    }
    return true;
}
fn report_error ( inspect : & str , config : & Vec < & str > , rc : i32 , substring : & str , should_output : bool , ) -> bool { match run_command ( inspect , config ) { Ok ( output ) => { let stdout = std :: str :: from_utf8 ( & output . stdout ) . unwrap_or ( " " ) ; if output . status . code ( ) == Some ( rc ) { if stdout . contains ( substring ) == should_output { return false ; } else { if should_output { println ! ( " \n \n " inspect config substring stdout ) ; } else { println ! ( " \n \n " inspect config substring stdout ) ; } } } else { println ! ( " \n \n " output status code ( ) rc inspect config stdout ) ; } } Err ( e ) => { println ! ( " " inspect config e ) ; } } return true ; }
If there's an error, print a summary and return true; otherwise, false.
If there ' s an error print a summary and return true ; otherwise false .
inspect
&str
config
&Vec<&str>
rc
i32
substring
&str
should_output
bool