fn filter_result(op: &mut Item) -> io::Result<()> {
    let result = mem::replace(&mut op.result, Ok(()));
    match result {
        Ok(_) => Ok(()),
        Err(e) => match e.kind() {
            IOErrorKind::AlreadyExists => {
                // mkdir of e.g. ~/.rustup already existing is just fine;
                // for others it would be better to know whether it is
                // expected to exist or not -so put a flag in the state.
                if let Kind::Directory = op.kind {
                    Ok(())
                } else {
                    Err(e)
                }
            }
            _ => Err(e),
        },
    }
}
/// Handle the async result of io operations
/// Replaces op.result with Ok(())
Handle the async result of io operations
Replaces op.result with Ok(())
Handle the async result of io operations Replaces op . result with Ok (( ))
fn filter_result(op: &mut Item) -> io::Result<()> {
    let result = mem::replace(&mut op.result, Ok(()));
    match result {
        Ok(_) => Ok(()),
        Err(e) => match e.kind() {
            IOErrorKind::AlreadyExists => {
                // mkdir of e.g. ~/.rustup already existing is just fine;
                // for others it would be better to know whether it is
                // expected to exist or not -so put a flag in the state.
                if let Kind::Directory = op.kind {
                    Ok(())
                } else {
                    Err(e)
                }
            }
            _ => Err(e),
        },
    }
}
fn filter_result ( op : & mut Item ) -> io :: Result < ( ) > { let result = mem :: replace ( & mut op . result , Ok ( ( ) ) ) ; match result { Ok ( _ ) => Ok ( ( ) ) , Err ( e ) => match e . kind ( ) { IOErrorKind :: AlreadyExists => { // mkdir of e.g. ~/.rustup already existing is just fine; // for others it would be better to know whether it is // expected to exist or not -so put a flag in the state. if let Kind :: Directory = op . kind { Ok ( ( ) ) } else { Err ( e ) } } _ => Err ( e ) , } , } }
Handle the async result of io operations
Replaces op.result with Ok(())
Handle the async result of io operations Replaces op . result with Ok (( ))
op
&mut Item