This commit is contained in:
Robin Appelman 2026-04-06 22:51:25 +02:00
commit 22c82c59af
7 changed files with 926 additions and 924 deletions

View file

@ -1,4 +1,4 @@
use std::fs::{read_dir, read_to_string, File};
use std::fs::{File, read_dir, read_to_string};
use std::io;
use std::io::{ErrorKind, Read, Seek};
use std::path::{Path, PathBuf};
@ -26,9 +26,8 @@ impl FileSource {
Ok(FileSource {
path: path.into(),
buff: String::with_capacity(32),
file: File::open(path).map_err(|e| {
file: File::open(path).inspect_err(|_| {
warn!("failed to open sensor {}", path.display());
e
})?,
})
}
@ -66,9 +65,8 @@ impl FileSource {
}
pub fn reopen(&mut self) -> io::Result<()> {
self.file = File::open(&self.path).map_err(|e| {
self.file = File::open(&self.path).inspect_err(|_| {
warn!("failed to open sensor {}", self.path.display());
e
})?;
Ok(())
}