mirror of https://github.com/helix-editor/helix
simplify pickup_last_saved_time
parent
45fb545ce9
commit
4647374449
|
@ -1182,19 +1182,10 @@ impl Document {
|
|||
|
||||
pub fn pickup_last_saved_time(&mut self) {
|
||||
self.last_saved_time = match self.path() {
|
||||
Some(path) => match path.metadata() {
|
||||
Ok(metadata) => match metadata.modified() {
|
||||
Ok(mtime) => mtime,
|
||||
Err(err) => {
|
||||
log::debug!("Could not fetch file system's mtime, falling back to current system time: {}", err);
|
||||
SystemTime::now()
|
||||
}
|
||||
},
|
||||
Err(err) => {
|
||||
log::debug!("Could not fetch file system's mtime, falling back to current system time: {}", err);
|
||||
SystemTime::now()
|
||||
}
|
||||
},
|
||||
Some(path) => path.metadata().and_then(|m| m.modified()).unwrap_or_else(|err| {
|
||||
log::debug!("Could not fetch file system's mtime, falling back to current system time: {}", err);
|
||||
SystemTime::now()
|
||||
}),
|
||||
None => SystemTime::now(),
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue