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) {
|
pub fn pickup_last_saved_time(&mut self) {
|
||||||
self.last_saved_time = match self.path() {
|
self.last_saved_time = match self.path() {
|
||||||
Some(path) => match path.metadata() {
|
Some(path) => path.metadata().and_then(|m| m.modified()).unwrap_or_else(|err| {
|
||||||
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);
|
log::debug!("Could not fetch file system's mtime, falling back to current system time: {}", err);
|
||||||
SystemTime::now()
|
SystemTime::now()
|
||||||
}
|
}),
|
||||||
},
|
|
||||||
Err(err) => {
|
|
||||||
log::debug!("Could not fetch file system's mtime, falling back to current system time: {}", err);
|
|
||||||
SystemTime::now()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
None => SystemTime::now(),
|
None => SystemTime::now(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue