// Returning errors to signal a clean up of the cache file may be necessary.
Returning errors to signal a clean up of the cache file may be necessary.
Returning errors to signal a clean up of the cache file may be necessary .
fn self_need_update_check() -> eyre::Result<NeedsCheck> {
    let update_check_cache_path = cache_dir().join(UPDATE_CHECK_FILENAME);
    let json = match fs::read(update_check_cache_path) {
        Ok(val) => val,
        // special case when no cache file exists, check is needed
        Err(err) if err.kind() == io::ErrorKind::NotFound => return Ok(NeedsCheck::Yes),
        Err(err) => return Err(err.into()),
    };
    let update_check = serde_json::from_slice::<UpdateCheck>(&json)?;
    Ok(update_check.remote_check_needed())
}
fn self_need_update_check ( ) -> eyre :: Result < NeedsCheck > { let update_check_cache_path = cache_dir ( ) . join ( UPDATE_CHECK_FILENAME ) ; let json = match fs :: read ( update_check_cache_path ) { Ok ( val ) => val , // special case when no cache file exists, check is needed Err ( err ) if err . kind ( ) == io :: ErrorKind :: NotFound => return Ok ( NeedsCheck :: Yes ) , Err ( err ) => return Err ( err . into ( ) ) , } ; let update_check = serde_json :: from_slice :: < UpdateCheck > ( & json ) ? ; Ok ( update_check . remote_check_needed ( ) ) }
Returning errors to signal a clean up of the cache file may be necessary.
Returning errors to signal a clean up of the cache file may be necessary .