improvement78 Remove Option<>
wrapper from ReadUtf8 arg.
There's no immediate usecase for distinguishing `Some`/`None`.
This commit is contained in:
parent
ac2d169333
commit
a5d0c48b35
@ -16,7 +16,7 @@ pub enum Error {
|
|||||||
},
|
},
|
||||||
|
|
||||||
#[error("File could not be read as UTF8: {0:?}")]
|
#[error("File could not be read as UTF8: {0:?}")]
|
||||||
ReadUtf8(Option<PathBuf>),
|
ReadUtf8(PathBuf),
|
||||||
|
|
||||||
#[error("Include error")]
|
#[error("Include error")]
|
||||||
Include {
|
Include {
|
||||||
|
@ -151,7 +151,7 @@ fn preprocess_inner<T: AsRef<Path>, U: AsRef<Path>, V: BuildHasher>(
|
|||||||
let mut s = String::new();
|
let mut s = String::new();
|
||||||
|
|
||||||
if let Err(_) = reader.read_to_string(&mut s) {
|
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 {
|
} else {
|
||||||
preprocess_str(
|
preprocess_str(
|
||||||
&s,
|
&s,
|
||||||
@ -1123,10 +1123,10 @@ mod tests {
|
|||||||
Error::ReadUtf8(path) => {
|
Error::ReadUtf8(path) => {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
path,
|
path,
|
||||||
Some(PathBuf::from(format!(
|
PathBuf::from(format!(
|
||||||
"{}/testcases/err_ReadUtf8.sv",
|
"{}/testcases/err_ReadUtf8.sv",
|
||||||
env::var("CARGO_MANIFEST_DIR").unwrap(),
|
env::var("CARGO_MANIFEST_DIR").unwrap(),
|
||||||
)))
|
))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user