message: Changed get_version_disk to return an Option and added is_outdated
diff: @@ -25,6 +25,12 @@ pub struct WranglerVersion {
  pub checked: bool,
  }
  +impl WranglerVersion {
  + pub fn is_outdated(&self) -> bool {
  + return self.checked;
  + }
  +}
  +
  #[derive(Clone, Debug, Deserialize, Serialize)]
  struct LastCheckedVersion {
  /// latest version as of last time we checked
  @@ -56,7 +62,7 @@ fn check_wrangler_versions() -> Result<WranglerVersion, failure::Error> {
  let mut checked = false;
  let current = get_installed_version()?;
  - let latest = match get_version_disk(&version_file)? {
  + let latest = match get_version_disk(&version_file) {
  Some(last_checked_version) => {
  let time_since_last_checked =
  current_time.duration_since(last_checked_version.last_checked)?;
  @@ -78,17 +84,14 @@ fn check_wrangler_versions() -> Result<WranglerVersion, failure::Error> {
  }
  /// Reads version out of version file, is `None` if file does not exist
  -fn get_version_disk(version_file: &PathBuf) -> Result<Option<LastCheckedVersion>, failure::Error> {
  - let local_version = match fs::read_to_string(&version_file) {
  - Ok(contents) => {
  - let last_checked_version = LastCheckedVersion::from_str(&contents)?;
  -
  - Some(last_checked_version)
  - }
  +fn get_version_disk(version_file: &PathBuf) -> Option<LastCheckedVersion> {
  + match fs::read_to_string(&version_file) {
  + Ok(contents) => match LastCheckedVersion::from_str(&contents) {
  + Ok(last_checked_version) => Some(last_checked_version),
  Err(_) => None,
  - };
  -
  - Ok(local_version)
  + },
  + Err(_) => None,
  + }
  }
  fn get_latest_version(
  @@ -141,7 +144,8 @@ pub fn background_check_for_updates() -> mpsc::Receiver<Version> {
  Ok(wrangler_versions) => {
  // If the wrangler version has not been checked within the last day and the versions
  // are different, print out an update message
  - if !wrangler_versions.checked && (wrangler_versions.current != wrangler_versions.latest)
  + if !wrangler_versions.is_outdated()
  + && (wrangler_versions.current != wrangler_versions.latest)
  {
  let _ = sender.send(wrangler_versions.latest);
  }
  