Simplify to_url.
@@ -120,14 +120,9 @@ pub trait ToUrl {
impl<P: AsRef<Path> + std::fmt::Debug> ToUrl for P {
fn to_url(&self) -> Result<Url> {
- Url::from_file_path(self).or_else(|_| (
- Url::from_str(&self.as_ref().to_string_lossy()).or_else(|_| {
- Err(format_err!(
- "Failed to convert from path ({:?}) to Url",
- self
- ))
- })
- ))
+ Url::from_file_path(self)
+ .or_else(|_| Url::from_str(&self.as_ref().to_string_lossy()))
+ .or_else(|_| Err(format_err!("Failed to convert ({:?}) to Url", self)))
}
}
