X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=crates%2Fpaths%2Fsrc%2Flib.rs;h=6ae23ac841adaa6a7f97d8841c57aec96f2d2439;hb=0fe3bcfd3524a023a11c95d0615178e897f72200;hp=b4beb40e746987b97b148b5dd8768965246538ea;hpb=fe7c5160846251f6f3f62b4a02f99f5fafa38cfa;p=rust.git diff --git a/crates/paths/src/lib.rs b/crates/paths/src/lib.rs index b4beb40e746..6ae23ac841a 100644 --- a/crates/paths/src/lib.rs +++ b/crates/paths/src/lib.rs @@ -1,5 +1,8 @@ //! Thin wrappers around `std::path`, distinguishing between absolute and //! relative paths. + +#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)] + use std::{ borrow::Borrow, ffi::OsStr, @@ -103,6 +106,14 @@ fn as_ref(&self) -> &Path { } } +impl ToOwned for AbsPath { + type Owned = AbsPathBuf; + + fn to_owned(&self) -> Self::Owned { + AbsPathBuf(self.0.to_owned()) + } +} + impl<'a> TryFrom<&'a Path> for &'a AbsPath { type Error = &'a Path; fn try_from(path: &'a Path) -> Result<&'a AbsPath, &'a Path> {