fn make_input(free_matches: &[String]) -> Option<(Input, Option<PathBuf>, Option<io::Error>)> {
    if free_matches.len() == 1 {
        let ifile = &free_matches[0];
        if ifile == "-" {
            let mut src = String::new();
            let err = if io::stdin().read_to_string(&mut src).is_err() {
                Some(io::Error::new(io::ErrorKind::InvalidData,
                                    "couldn't read from stdin, as it did not contain valid UTF-8"))
            } else {
                None
            };
            Some((Input::Str { name: FileName::Anon, input: src },
                  None, err))
        } else {
            Some((Input::File(PathBuf::from(ifile)),
                  Some(PathBuf::from(ifile)), None))
        }
    } else {
        None
    }
}
// Extract input (string or file and optional path) from matches.
Extract input (string or file and optional path) from matches.
Extract input ( string or file and optional path ) from matches .
fn make_input(free_matches: &[String]) -> Option<(Input, Option<PathBuf>, Option<io::Error>)> {
    if free_matches.len() == 1 {
        let ifile = &free_matches[0];
        if ifile == "-" {
            let mut src = String::new();
            let err = if io::stdin().read_to_string(&mut src).is_err() {
                Some(io::Error::new(io::ErrorKind::InvalidData,
                                    "couldn't read from stdin, as it did not contain valid UTF-8"))
            } else {
                None
            };
            Some((Input::Str { name: FileName::Anon, input: src },
                  None, err))
        } else {
            Some((Input::File(PathBuf::from(ifile)),
                  Some(PathBuf::from(ifile)), None))
        }
    } else {
        None
    }
}
fn make_input ( free_matches : & [ String ] ) -> Option < ( Input , Option < PathBuf > , Option < io :: Error > ) > { if free_matches . len ( ) == 1 { let ifile = & free_matches [ 0 ] ; if ifile == " " { let mut src = String :: new ( ) ; let err = if io :: stdin ( ) . read_to_string ( & mut src ) . is_err ( ) { Some ( io :: Error :: new ( io :: ErrorKind :: InvalidData , " " ) ) } else { None } ; Some ( ( Input :: Str { name : FileName :: Anon , input : src } , None , err ) ) } else { Some ( ( Input :: File ( PathBuf :: from ( ifile ) ) , Some ( PathBuf :: from ( ifile ) ) , None ) ) } } else { None } }
Extract input (string or file and optional path) from matches.
Extract input ( string or file and optional path ) from matches .
free_matches
&[String]
free_matches
&[String]