fn self_update_check() -> Option<&'static str> {
    match self_need_update_check() {
        // fall through to update check
        Ok(NeedsCheck::Yes) => {
            eprintln!("update check will be perform")
        }

        Ok(NeedsCheck::No) => {
            eprintln!("skip update check");
            return None;
        }

        // cached file shows that self is outdated so skip API lookup
        Ok(NeedsCheck::KnownOutdated) => return Some(LATEST_URL),

        // eg. time::Date changes it's serde format causing json deserialization to fail
        Err(err) => {
            let check_file = cache_dir().join(UPDATE_CHECK_FILENAME);

            eprintln!("update check cache failed: {}", err);
            eprintln!("deleting update check file from: {:?}", check_file);

            // attempt to clean up any potentially corrupted cache state
            let _ = fs::remove_file(check_file);

            // fall through to update check
        }
    }

    // ignore errors from fetching for cases when no internet connection is available
    match self_update_check_inner() {
        Ok(true) => return Some(LATEST_URL),
        Ok(false) => {
            eprintln!("no update available");
        }
        Err(err) => {
            eprintln!("error fetching update: {}", err);
        }
    }

    None
}
/// Returning None means no action to take.
Returning None means no action to take.
Returning None means no action to take .
fn self_update_check() -> Option<&'static str> {
    match self_need_update_check() {
        // fall through to update check
        Ok(NeedsCheck::Yes) => {
            eprintln!("update check will be perform")
        }
        Ok(NeedsCheck::No) => {
            eprintln!("skip update check");
            return None;
        }
        // cached file shows that self is outdated so skip API lookup
        Ok(NeedsCheck::KnownOutdated) => return Some(LATEST_URL),
        // eg. time::Date changes it's serde format causing json deserialization to fail
        Err(err) => {
            let check_file = cache_dir().join(UPDATE_CHECK_FILENAME);
            eprintln!("update check cache failed: {}", err);
            eprintln!("deleting update check file from: {:?}", check_file);
            // attempt to clean up any potentially corrupted cache state
            let _ = fs::remove_file(check_file);
            // fall through to update check
        }
    }
    // ignore errors from fetching for cases when no internet connection is available
    match self_update_check_inner() {
        Ok(true) => return Some(LATEST_URL),
        Ok(false) => {
            eprintln!("no update available");
        }
        Err(err) => {
            eprintln!("error fetching update: {}", err);
        }
    }
    None
}
fn self_update_check ( ) -> Option < & ' static str > { match self_need_update_check ( ) { // fall through to update check Ok ( NeedsCheck :: Yes ) => { eprintln ! ( " " ) } Ok ( NeedsCheck :: No ) => { eprintln ! ( " " ) ; return None ; } // cached file shows that self is outdated so skip API lookup Ok ( NeedsCheck :: KnownOutdated ) => return Some ( LATEST_URL ) , // eg. time::Date changes it's serde format causing json deserialization to fail Err ( err ) => { let check_file = cache_dir ( ) . join ( UPDATE_CHECK_FILENAME ) ; eprintln ! ( " " err ) ; eprintln ! ( " " check_file ) ; // attempt to clean up any potentially corrupted cache state let _ = fs :: remove_file ( check_file ) ; // fall through to update check } } // ignore errors from fetching for cases when no internet connection is available match self_update_check_inner ( ) { Ok ( true ) => return Some ( LATEST_URL ) , Ok ( false ) => { eprintln ! ( " " ) ; } Err ( err ) => { eprintln ! ( " " err ) ; } } None }
Returning None means no action to take.
Returning None means no action to take .