rustdoc: Remove a single-use macro
I think the new code is simpler and easier to understand.
This commit is contained in:
parent
7865a85eb6
commit
581dc75888
@ -15,15 +15,6 @@ use std::path::{Path, PathBuf};
|
|||||||
use std::string::ToString;
|
use std::string::ToString;
|
||||||
use std::sync::mpsc::Sender;
|
use std::sync::mpsc::Sender;
|
||||||
|
|
||||||
macro_rules! try_err {
|
|
||||||
($e:expr, $file:expr) => {
|
|
||||||
match $e {
|
|
||||||
Ok(e) => e,
|
|
||||||
Err(e) => return Err(E::new(e, $file)),
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
crate trait PathError {
|
crate trait PathError {
|
||||||
fn new<S, P: AsRef<Path>>(e: S, path: P) -> Self
|
fn new<S, P: AsRef<Path>>(e: S, path: P) -> Self
|
||||||
where
|
where
|
||||||
@ -75,7 +66,7 @@ impl DocFS {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
try_err!(fs::write(&path, contents), path);
|
fs::write(&path, contents).map_err(|e| E::new(e, path))?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user