improvement78 Remove Option<> wrapper from ReadUtf8 arg.

There's no immediate usecase for distinguishing `Some`/`None`.
This commit is contained in:
damc 2023-02-07 19:17:57 +01:00
parent ac2d169333
commit a5d0c48b35
2 changed files with 4 additions and 4 deletions

View File

@ -16,7 +16,7 @@ pub enum Error {
},
#[error("File could not be read as UTF8: {0:?}")]
ReadUtf8(Option<PathBuf>),
ReadUtf8(PathBuf),
#[error("Include error")]
Include {

View File

@ -151,7 +151,7 @@ fn preprocess_inner<T: AsRef<Path>, U: AsRef<Path>, V: BuildHasher>(
let mut s = String::new();
if let Err(_) = reader.read_to_string(&mut s) {
Err(Error::ReadUtf8(Some(PathBuf::from(path.as_ref()))))
Err(Error::ReadUtf8(PathBuf::from(path.as_ref())))
} else {
preprocess_str(
&s,
@ -1123,10 +1123,10 @@ mod tests {
Error::ReadUtf8(path) => {
assert_eq!(
path,
Some(PathBuf::from(format!(
PathBuf::from(format!(
"{}/testcases/err_ReadUtf8.sv",
env::var("CARGO_MANIFEST_DIR").unwrap(),
)))
))
);
}
_ => {