diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 814d2c9..12c101e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,8 +69,8 @@ jobs: - { rust: stable, os: ubuntu-latest, flags: "--no-default-features" } - { rust: stable, os: ubuntu-latest, target: wasm32-unknown-unknown, flags: "--all-features" } - { rust: stable, os: ubuntu-latest, target: wasm32-unknown-unknown, flags: "--no-default-features" } - - { rust: 1.58.1, os: ubuntu-latest, flags: "--all-features" } - - { rust: 1.58.1, os: ubuntu-latest, flags: "--no-default-features" } + - { rust: 1.65.0, os: ubuntu-latest, flags: "--all-features" } + - { rust: 1.65.0, os: ubuntu-latest, flags: "--no-default-features" } steps: - uses: actions/checkout@v2 - name: Install Rust ${{ matrix.rust }} ${{ matrix.target }} diff --git a/Cargo.toml b/Cargo.toml index d7a0e04..fc802f9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "typed-path" description = "Provides typed variants of Path and PathBuf for Unix and Windows" version = "0.10.0" edition = "2021" -rust-version = "1.58.1" +rust-version = "1.65.0" authors = ["Chip Senkbeil "] categories = ["development-tools", "filesystem", "os"] keywords = ["unicode", "utf8", "paths", "filesystem"] diff --git a/README.md b/README.md index 9f024a7..350d97d 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ [doc_lnk]: https://docs.rs/typed-path [ci_img]: https://github.com/chipsenkbeil/typed-path/actions/workflows/ci.yml/badge.svg [ci_lnk]: https://github.com/chipsenkbeil/typed-path/actions/workflows/ci.yml -[rustc_img]: https://img.shields.io/badge/rustc_1.58.1+-lightgray.svg -[rustc_lnk]: https://blog.rust-lang.org/2022/01/20/Rust-1.58.1.html +[rustc_img]: https://img.shields.io/badge/rustc_1.65.0+-lightgray.svg +[rustc_lnk]: https://blog.rust-lang.org/2022/11/03/Rust-1.65.0/ Provides typed variants of [`Path`][StdPath] and [`PathBuf`][StdPathBuf] for Unix and Windows. diff --git a/src/common/non_utf8.rs b/src/common/non_utf8.rs index 175965b..45d2161 100644 --- a/src/common/non_utf8.rs +++ b/src/common/non_utf8.rs @@ -19,15 +19,15 @@ use crate::no_std_compat::*; use crate::private; /// Interface to provide meaning to a byte slice such that paths can be derived -pub trait Encoding<'a>: private::Sealed { +pub trait Encoding: private::Sealed { /// Represents the type of component that will be derived by this encoding - type Components: Components<'a>; + type Components<'a>: Components<'a>; /// Static label representing encoding type fn label() -> &'static str; /// Produces an iterator of [`Component`]s over the given the byte slice (`path`) - fn components(path: &'a [u8]) -> Self::Components; + fn components(path: &[u8]) -> Self::Components<'_>; /// Hashes a byte slice (`path`) fn hash(path: &[u8], h: &mut H); diff --git a/src/common/non_utf8/iter.rs b/src/common/non_utf8/iter.rs index a862a8f..cf83394 100644 --- a/src/common/non_utf8/iter.rs +++ b/src/common/non_utf8/iter.rs @@ -13,17 +13,17 @@ use crate::{Component, Components, Encoding, Path}; #[derive(Clone)] pub struct Iter<'a, T> where - T: Encoding<'a>, + T: Encoding, { _encoding: PhantomData, - inner: >::Components, + inner: ::Components<'a>, } impl<'a, T> Iter<'a, T> where - T: for<'enc> Encoding<'enc> + 'a, + T: Encoding, { - pub(crate) fn new(inner: >::Components) -> Self { + pub(crate) fn new(inner: ::Components<'a>) -> Self { Self { _encoding: PhantomData, inner, @@ -51,16 +51,16 @@ where impl<'a, T> fmt::Debug for Iter<'a, T> where - T: for<'enc> Encoding<'enc> + 'a, + T: for<'enc> Encoding + 'a, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { struct DebugHelper<'a, T>(&'a Path) where - T: for<'enc> Encoding<'enc>; + T: for<'enc> Encoding; impl fmt::Debug for DebugHelper<'_, T> where - T: for<'enc> Encoding<'enc>, + T: for<'enc> Encoding, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_list().entries(self.0.iter()).finish() @@ -75,7 +75,7 @@ where impl<'a, T> AsRef> for Iter<'a, T> where - T: for<'enc> Encoding<'enc> + 'a, + T: for<'enc> Encoding + 'a, { #[inline] fn as_ref(&self) -> &Path { @@ -85,7 +85,7 @@ where impl<'a, T> AsRef<[u8]> for Iter<'a, T> where - T: for<'enc> Encoding<'enc> + 'a, + T: for<'enc> Encoding + 'a, { #[inline] fn as_ref(&self) -> &[u8] { @@ -95,7 +95,7 @@ where impl<'a, T> Iterator for Iter<'a, T> where - T: for<'enc> Encoding<'enc> + 'a, + T: for<'enc> Encoding + 'a, { type Item = &'a [u8]; @@ -110,7 +110,7 @@ where impl<'a, T> DoubleEndedIterator for Iter<'a, T> where - T: for<'enc> Encoding<'enc> + 'a, + T: for<'enc> Encoding + 'a, { #[inline] fn next_back(&mut self) -> Option { @@ -121,7 +121,7 @@ where } } -impl<'a, T> FusedIterator for Iter<'a, T> where T: for<'enc> Encoding<'enc> + 'a {} +impl<'a, T> FusedIterator for Iter<'a, T> where T: for<'enc> Encoding + 'a {} /// An iterator over [`Path`] and its ancestors. /// @@ -145,14 +145,14 @@ impl<'a, T> FusedIterator for Iter<'a, T> where T: for<'enc> Encoding<'enc> + 'a #[derive(Copy, Clone, Debug)] pub struct Ancestors<'a, T> where - T: for<'enc> Encoding<'enc>, + T: for<'enc> Encoding, { pub(crate) next: Option<&'a Path>, } impl<'a, T> Iterator for Ancestors<'a, T> where - T: for<'enc> Encoding<'enc>, + T: for<'enc> Encoding, { type Item = &'a Path; @@ -164,4 +164,4 @@ where } } -impl FusedIterator for Ancestors<'_, T> where T: for<'enc> Encoding<'enc> {} +impl FusedIterator for Ancestors<'_, T> where T: for<'enc> Encoding {} diff --git a/src/common/non_utf8/path.rs b/src/common/non_utf8/path.rs index 5dcef27..e60fe30 100644 --- a/src/common/non_utf8/path.rs +++ b/src/common/non_utf8/path.rs @@ -75,7 +75,7 @@ use crate::no_std_compat::*; #[repr(transparent)] pub struct Path where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Encoding associated with path buf _encoding: PhantomData, @@ -86,7 +86,7 @@ where impl Path where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Directly wraps a byte slice as a `Path` slice. /// @@ -805,7 +805,7 @@ where /// ``` /// /// [`CurDir`]: crate::unix::UnixComponent::CurDir - pub fn components(&self) -> >::Components { + pub fn components(&self) -> ::Components<'_> { T::components(&self.inner) } @@ -891,7 +891,7 @@ where /// ``` pub fn with_encoding(&self) -> PathBuf where - U: for<'enc> Encoding<'enc>, + U: Encoding, { // If we're the same, just return the path buf, which // we do with a fancy trick to convert it @@ -906,17 +906,17 @@ where for component in self.components() { if component.is_root() { path.push(< - <::Components as Components>::Component + <::Components<'_> as Components>::Component as Component >::root().as_bytes()); } else if component.is_current() { path.push(< - <::Components as Components>::Component + <::Components<'_> as Components>::Component as Component >::current().as_bytes()); } else if component.is_parent() { path.push(< - <::Components as Components>::Component + <::Components<'_> as Components>::Component as Component >::parent().as_bytes()); } else { @@ -971,7 +971,7 @@ where /// ``` pub fn with_encoding_checked(&self) -> Result, CheckedPathError> where - U: for<'enc> Encoding<'enc>, + U: Encoding, { let mut path = PathBuf::new(); @@ -981,18 +981,18 @@ where for component in self.components() { if component.is_root() { path.push( - <<::Components as Components>::Component as Component>::root() + <<::Components<'_> as Components>::Component as Component>::root() .as_bytes(), ); } else if component.is_current() { path.push( - <<::Components as Components>::Component as Component>::current( + <<::Components<'_> as Components>::Component as Component>::current( ) .as_bytes(), ); } else if component.is_parent() { path.push( - <<::Components as Components>::Component as Component>::parent() + <<::Components<'_> as Components>::Component as Component>::parent() .as_bytes(), ); } else { @@ -1017,7 +1017,7 @@ where impl Clone for Box> where - T: for<'enc> Encoding<'enc>, + T: Encoding, { fn clone(&self) -> Self { self.to_path_buf().into_boxed_path() @@ -1026,7 +1026,7 @@ where impl AsRef<[u8]> for Path where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn as_ref(&self) -> &[u8] { @@ -1036,7 +1036,7 @@ where impl AsRef> for Path where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn as_ref(&self) -> &Path { @@ -1046,7 +1046,7 @@ where impl AsRef> for [u8] where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn as_ref(&self) -> &Path { @@ -1056,7 +1056,7 @@ where impl AsRef> for Cow<'_, [u8]> where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn as_ref(&self) -> &Path { @@ -1066,7 +1066,7 @@ where impl AsRef> for Vec where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn as_ref(&self) -> &Path { @@ -1076,7 +1076,7 @@ where impl AsRef> for str where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn as_ref(&self) -> &Path { @@ -1086,7 +1086,7 @@ where impl AsRef> for String where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn as_ref(&self) -> &Path { @@ -1096,7 +1096,7 @@ where impl fmt::Debug for Path where - T: for<'enc> Encoding<'enc>, + T: Encoding, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Path") @@ -1108,7 +1108,7 @@ where impl fmt::Display for Path where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Format path by converting bytes to a [`String`]. This may perform lossy conversion, /// depending on the platform. If you would like an implementation which escapes the path @@ -1134,7 +1134,7 @@ where impl cmp::PartialEq for Path where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn eq(&self, other: &Path) -> bool { @@ -1142,11 +1142,11 @@ where } } -impl cmp::Eq for Path where T: for<'enc> Encoding<'enc> {} +impl cmp::Eq for Path where T: Encoding {} impl Hash for Path where - T: for<'enc> Encoding<'enc>, + T: Encoding, { fn hash(&self, h: &mut H) { T::hash(self.as_bytes(), h) @@ -1155,7 +1155,7 @@ where impl cmp::PartialOrd for Path where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn partial_cmp(&self, other: &Path) -> Option { @@ -1165,7 +1165,7 @@ where impl cmp::Ord for Path where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn cmp(&self, other: &Path) -> cmp::Ordering { @@ -1175,7 +1175,7 @@ where impl From<&Path> for Box> where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Creates a boxed [`Path`] from a reference. /// @@ -1189,7 +1189,7 @@ where impl From>> for Box> where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Creates a boxed [`Path`] from a clone-on-write pointer. /// @@ -1205,7 +1205,7 @@ where impl From> for Box> where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Converts a [`PathBuf`] into a [Box]<[Path]>. /// @@ -1219,7 +1219,7 @@ where impl<'a, T> From<&'a Path> for Cow<'a, Path> where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Creates a clone-on-write pointer from a reference to /// [`Path`]. @@ -1233,7 +1233,7 @@ where impl From> for Cow<'_, Path> where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Creates a clone-on-write pointer from an owned /// instance of [`PathBuf`]. @@ -1247,7 +1247,7 @@ where impl<'a, T> From<&'a PathBuf> for Cow<'a, Path> where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Creates a clone-on-write pointer from a reference to /// [`PathBuf`]. @@ -1261,7 +1261,7 @@ where impl From> for Arc> where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Converts a [`PathBuf`] into an [Arc]<[Path]> by moving the [`PathBuf`] data /// into a new [`Arc`] buffer. @@ -1274,7 +1274,7 @@ where impl From<&Path> for Arc> where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Converts a [`Path`] into an [`Arc`] by copying the [`Path`] data into a new [`Arc`] buffer. #[inline] @@ -1286,7 +1286,7 @@ where impl From> for Rc> where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Converts a [`PathBuf`] into an [Rc]<[Path]> by moving the [`PathBuf`] data into /// a new [`Rc`] buffer. @@ -1299,7 +1299,7 @@ where impl From<&Path> for Rc> where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Converts a [`Path`] into an [`Rc`] by copying the [`Path`] data into a new [`Rc`] buffer. #[inline] @@ -1311,7 +1311,7 @@ where impl<'a, T> IntoIterator for &'a Path where - T: for<'enc> Encoding<'enc>, + T: Encoding, { type IntoIter = Iter<'a, T>; type Item = &'a [u8]; @@ -1324,7 +1324,7 @@ where impl ToOwned for Path where - T: for<'enc> Encoding<'enc>, + T: Encoding, { type Owned = PathBuf; @@ -1338,7 +1338,7 @@ macro_rules! impl_cmp { ($($lt:lifetime),* ; $lhs:ty, $rhs: ty) => { impl<$($lt,)* T> PartialEq<$rhs> for $lhs where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn eq(&self, other: &$rhs) -> bool { @@ -1348,7 +1348,7 @@ macro_rules! impl_cmp { impl<$($lt,)* T> PartialEq<$lhs> for $rhs where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn eq(&self, other: &$lhs) -> bool { @@ -1358,7 +1358,7 @@ macro_rules! impl_cmp { impl<$($lt,)* T> PartialOrd<$rhs> for $lhs where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn partial_cmp(&self, other: &$rhs) -> Option { @@ -1368,7 +1368,7 @@ macro_rules! impl_cmp { impl<$($lt,)* T> PartialOrd<$lhs> for $rhs where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn partial_cmp(&self, other: &$lhs) -> Option { @@ -1388,7 +1388,7 @@ macro_rules! impl_cmp_bytes { ($($lt:lifetime),* ; $lhs:ty, $rhs: ty) => { impl<$($lt,)* T> PartialEq<$rhs> for $lhs where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn eq(&self, other: &$rhs) -> bool { @@ -1398,7 +1398,7 @@ macro_rules! impl_cmp_bytes { impl<$($lt,)* T> PartialEq<$lhs> for $rhs where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn eq(&self, other: &$lhs) -> bool { @@ -1408,7 +1408,7 @@ macro_rules! impl_cmp_bytes { impl<$($lt,)* T> PartialOrd<$rhs> for $lhs where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn partial_cmp(&self, other: &$rhs) -> Option { @@ -1418,7 +1418,7 @@ macro_rules! impl_cmp_bytes { impl<$($lt,)* T> PartialOrd<$lhs> for $rhs where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn partial_cmp(&self, other: &$lhs) -> Option { @@ -1515,7 +1515,7 @@ mod std_conversions { impl AsRef> for OsStr where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn as_ref(&self) -> &Path { @@ -1525,7 +1525,7 @@ mod std_conversions { impl AsRef> for OsString where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn as_ref(&self) -> &Path { @@ -1535,7 +1535,7 @@ mod std_conversions { impl AsRef for Path where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn as_ref(&self) -> &OsStr { diff --git a/src/common/non_utf8/path/display.rs b/src/common/non_utf8/path/display.rs index 49f6748..32f126c 100644 --- a/src/common/non_utf8/path/display.rs +++ b/src/common/non_utf8/path/display.rs @@ -26,14 +26,14 @@ use crate::{Encoding, Path}; /// [`format!`]: std::format pub struct Display<'a, T> where - T: for<'enc> Encoding<'enc>, + T: Encoding, { pub(crate) path: &'a Path, } impl fmt::Debug for Display<'_, T> where - T: for<'enc> Encoding<'enc>, + T: Encoding, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&self.path, f) @@ -42,7 +42,7 @@ where impl fmt::Display for Display<'_, T> where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Performs lossy conversion to UTF-8 str fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/src/common/non_utf8/pathbuf.rs b/src/common/non_utf8/pathbuf.rs index df157cf..8701c8e 100644 --- a/src/common/non_utf8/pathbuf.rs +++ b/src/common/non_utf8/pathbuf.rs @@ -60,7 +60,7 @@ use crate::{CheckedPathError, Encoding, Iter, Path}; /// Which method works best depends on what kind of situation you're in. pub struct PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Encoding associated with path buf pub(crate) _encoding: PhantomData, @@ -71,7 +71,7 @@ where impl PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Allocates an empty `PathBuf`. /// @@ -447,7 +447,7 @@ where impl Clone for PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn clone(&self) -> Self { @@ -460,7 +460,7 @@ where impl fmt::Debug for PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("PathBuf") @@ -472,7 +472,7 @@ where impl AsRef<[u8]> for PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn as_ref(&self) -> &[u8] { @@ -482,7 +482,7 @@ where impl AsRef> for PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn as_ref(&self) -> &Path { @@ -492,7 +492,7 @@ where impl Borrow> for PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn borrow(&self) -> &Path { @@ -502,7 +502,7 @@ where impl Default for PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn default() -> PathBuf { @@ -512,7 +512,7 @@ where impl Deref for PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { type Target = Path; @@ -522,11 +522,11 @@ where } } -impl Eq for PathBuf where T: for<'enc> Encoding<'enc> {} +impl Eq for PathBuf where T: Encoding {} impl PartialEq for PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { fn eq(&self, other: &Self) -> bool { self.components() == other.components() @@ -535,7 +535,7 @@ where impl Extend

for PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, P: AsRef>, { fn extend>(&mut self, iter: I) { @@ -545,7 +545,7 @@ where impl From>> for PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { fn from(boxed: Box>) -> Self { boxed.into_path_buf() @@ -554,7 +554,7 @@ where impl From<&V> for PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, V: ?Sized + AsRef<[u8]>, { /// Converts a borrowed [`[u8]`] to a [`PathBuf`]. @@ -568,7 +568,7 @@ where impl From> for PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Converts a [`Vec`] into a [`PathBuf`] /// @@ -584,7 +584,7 @@ where impl From> for Vec where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Converts a [`PathBuf`] into a [`Vec`] /// @@ -597,7 +597,7 @@ where impl From for PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Converts a [`String`] into a [`PathBuf`] /// @@ -610,7 +610,7 @@ where impl FromStr for PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { type Err = core::convert::Infallible; @@ -622,7 +622,7 @@ where impl<'a, T> From>> for PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Converts a clone-on-write pointer to an owned path. /// @@ -635,7 +635,7 @@ where impl FromIterator

for PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, P: AsRef>, { fn from_iter>(iter: I) -> Self { @@ -647,7 +647,7 @@ where impl Hash for PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { fn hash(&self, h: &mut H) { self.as_path().hash(h) @@ -656,7 +656,7 @@ where impl<'a, T> IntoIterator for &'a PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { type IntoIter = Iter<'a, T>; type Item = &'a [u8]; @@ -669,7 +669,7 @@ where impl cmp::PartialOrd for PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn partial_cmp(&self, other: &Self) -> Option { @@ -679,7 +679,7 @@ where impl cmp::Ord for PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn cmp(&self, other: &Self) -> cmp::Ordering { @@ -690,7 +690,7 @@ where #[cfg(feature = "std")] impl TryFrom> for std::path::PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { type Error = PathBuf; @@ -718,7 +718,7 @@ where #[cfg(feature = "std")] impl TryFrom for PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { type Error = std::path::PathBuf; @@ -768,7 +768,7 @@ mod std_conversions { impl From> for OsString where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn from(path_buf: PathBuf) -> Self { @@ -778,7 +778,7 @@ mod std_conversions { impl AsRef for PathBuf where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn as_ref(&self) -> &OsStr { diff --git a/src/common/utf8.rs b/src/common/utf8.rs index 89ce704..46ada12 100644 --- a/src/common/utf8.rs +++ b/src/common/utf8.rs @@ -15,15 +15,15 @@ use crate::no_std_compat::*; use crate::private; /// Interface to provide meaning to a byte slice such that paths can be derived -pub trait Utf8Encoding<'a>: private::Sealed { +pub trait Utf8Encoding: private::Sealed { /// Represents the type of component that will be derived by this encoding - type Components: Utf8Components<'a>; + type Components<'a>: Utf8Components<'a>; /// Static label representing encoding type fn label() -> &'static str; /// Produces an iterator of [`Utf8Component`]s over the given the byte slice (`path`) - fn components(path: &'a str) -> Self::Components; + fn components(path: &str) -> Self::Components<'_>; /// Hashes a utf8 str (`path`) fn hash(path: &str, h: &mut H); diff --git a/src/common/utf8/iter.rs b/src/common/utf8/iter.rs index b8dbfef..f7c93d0 100644 --- a/src/common/utf8/iter.rs +++ b/src/common/utf8/iter.rs @@ -13,17 +13,17 @@ use crate::{Utf8Component, Utf8Components, Utf8Encoding, Utf8Path}; #[derive(Clone)] pub struct Utf8Iter<'a, T> where - T: Utf8Encoding<'a>, + T: Utf8Encoding, { _encoding: PhantomData, - inner: >::Components, + inner: ::Components<'a>, } impl<'a, T> Utf8Iter<'a, T> where - T: for<'enc> Utf8Encoding<'enc> + 'a, + T: Utf8Encoding + 'a, { - pub(crate) fn new(inner: >::Components) -> Self { + pub(crate) fn new(inner: ::Components<'a>) -> Self { Self { _encoding: PhantomData, inner, @@ -51,16 +51,16 @@ where impl<'a, T> fmt::Debug for Utf8Iter<'a, T> where - T: for<'enc> Utf8Encoding<'enc> + 'a, + T: Utf8Encoding + 'a, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { struct DebugHelper<'a, T>(&'a Utf8Path) where - T: for<'enc> Utf8Encoding<'enc>; + T: Utf8Encoding; impl fmt::Debug for DebugHelper<'_, T> where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_list().entries(self.0.iter()).finish() @@ -75,7 +75,7 @@ where impl<'a, T> AsRef> for Utf8Iter<'a, T> where - T: for<'enc> Utf8Encoding<'enc> + 'a, + T: Utf8Encoding + 'a, { #[inline] fn as_ref(&self) -> &Utf8Path { @@ -85,7 +85,7 @@ where impl<'a, T> AsRef<[u8]> for Utf8Iter<'a, T> where - T: for<'enc> Utf8Encoding<'enc> + 'a, + T: Utf8Encoding + 'a, { #[inline] fn as_ref(&self) -> &[u8] { @@ -95,7 +95,7 @@ where impl<'a, T> AsRef for Utf8Iter<'a, T> where - T: for<'enc> Utf8Encoding<'enc> + 'a, + T: Utf8Encoding + 'a, { #[inline] fn as_ref(&self) -> &str { @@ -105,7 +105,7 @@ where impl<'a, T> Iterator for Utf8Iter<'a, T> where - T: for<'enc> Utf8Encoding<'enc> + 'a, + T: Utf8Encoding + 'a, { type Item = &'a str; @@ -120,7 +120,7 @@ where impl<'a, T> DoubleEndedIterator for Utf8Iter<'a, T> where - T: for<'enc> Utf8Encoding<'enc> + 'a, + T: Utf8Encoding + 'a, { #[inline] fn next_back(&mut self) -> Option { @@ -131,7 +131,7 @@ where } } -impl<'a, T> FusedIterator for Utf8Iter<'a, T> where T: for<'enc> Utf8Encoding<'enc> + 'a {} +impl<'a, T> FusedIterator for Utf8Iter<'a, T> where T: Utf8Encoding + 'a {} /// An iterator over [`Utf8Path`] and its ancestors. /// @@ -155,14 +155,14 @@ impl<'a, T> FusedIterator for Utf8Iter<'a, T> where T: for<'enc> Utf8Encoding<'e #[derive(Copy, Clone, Debug)] pub struct Utf8Ancestors<'a, T> where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { pub(crate) next: Option<&'a Utf8Path>, } impl<'a, T> Iterator for Utf8Ancestors<'a, T> where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { type Item = &'a Utf8Path; @@ -174,4 +174,4 @@ where } } -impl FusedIterator for Utf8Ancestors<'_, T> where T: for<'enc> Utf8Encoding<'enc> {} +impl FusedIterator for Utf8Ancestors<'_, T> where T: Utf8Encoding {} diff --git a/src/common/utf8/path.rs b/src/common/utf8/path.rs index 3284ef1..d8460b7 100644 --- a/src/common/utf8/path.rs +++ b/src/common/utf8/path.rs @@ -73,7 +73,7 @@ use crate::{ #[repr(transparent)] pub struct Utf8Path where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { /// Encoding associated with path buf _encoding: PhantomData, @@ -84,7 +84,7 @@ where impl Utf8Path where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { /// Directly wraps a str slice as a `Utf8Path` slice. /// @@ -760,7 +760,7 @@ where /// ``` /// /// [`CurDir`]: crate::unix::UnixComponent::CurDir - pub fn components(&self) -> >::Components { + pub fn components(&self) -> ::Components<'_> { T::components(&self.inner) } @@ -823,7 +823,7 @@ where /// ``` pub fn with_encoding(&self) -> Utf8PathBuf where - U: for<'enc> Utf8Encoding<'enc>, + U: Utf8Encoding, { // If we're the same, just return the path buf, which // we do with a fancy trick to convert it @@ -838,17 +838,17 @@ where for component in self.components() { if component.is_root() { path.push(< - <::Components as Utf8Components>::Component + <::Components<'_> as Utf8Components>::Component as Utf8Component >::root().as_str()); } else if component.is_current() { path.push(< - <::Components as Utf8Components>::Component + <::Components<'_> as Utf8Components>::Component as Utf8Component >::current().as_str()); } else if component.is_parent() { path.push(< - <::Components as Utf8Components>::Component + <::Components<'_> as Utf8Components>::Component as Utf8Component >::parent().as_str()); } else { @@ -903,7 +903,7 @@ where /// ``` pub fn with_encoding_checked(&self) -> Result, CheckedPathError> where - U: for<'enc> Utf8Encoding<'enc>, + U: Utf8Encoding, { let mut path = Utf8PathBuf::new(); @@ -913,17 +913,17 @@ where for component in self.components() { if component.is_root() { path.push(< - <::Components as Utf8Components>::Component + <::Components<'_> as Utf8Components>::Component as Utf8Component >::root().as_str()); } else if component.is_current() { path.push(< - <::Components as Utf8Components>::Component + <::Components<'_> as Utf8Components>::Component as Utf8Component >::current().as_str()); } else if component.is_parent() { path.push(< - <::Components as Utf8Components>::Component + <::Components<'_> as Utf8Components>::Component as Utf8Component >::parent().as_str()); } else { @@ -964,7 +964,7 @@ where /// ``` pub fn from_bytes_path(path: &Path) -> Result<&Self, Utf8Error> where - U: for<'enc> Encoding<'enc>, + U: Encoding, { Ok(Self::new(core::str::from_utf8(path.as_bytes())?)) } @@ -993,7 +993,7 @@ where /// ``` pub unsafe fn from_bytes_path_unchecked(path: &Path) -> &Self where - U: for<'enc> Encoding<'enc>, + U: Encoding, { Self::new(core::str::from_utf8_unchecked(path.as_bytes())) } @@ -1011,7 +1011,7 @@ where /// ``` pub fn as_bytes_path(&self) -> &Path where - U: for<'enc> Encoding<'enc>, + U: Encoding, { Path::new(self.as_str()) } @@ -1019,7 +1019,7 @@ where impl Clone for Box> where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { fn clone(&self) -> Self { self.to_path_buf().into_boxed_path() @@ -1028,7 +1028,7 @@ where impl AsRef<[u8]> for Utf8Path where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn as_ref(&self) -> &[u8] { @@ -1038,7 +1038,7 @@ where impl AsRef for Utf8Path where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn as_ref(&self) -> &str { @@ -1048,7 +1048,7 @@ where impl AsRef> for Utf8Path where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn as_ref(&self) -> &Utf8Path { @@ -1058,7 +1058,7 @@ where impl AsRef> for str where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn as_ref(&self) -> &Utf8Path { @@ -1068,7 +1068,7 @@ where impl AsRef> for Cow<'_, str> where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn as_ref(&self) -> &Utf8Path { @@ -1078,7 +1078,7 @@ where impl AsRef> for String where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn as_ref(&self) -> &Utf8Path { @@ -1088,7 +1088,7 @@ where impl fmt::Debug for Utf8Path where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Utf8Path") @@ -1100,7 +1100,7 @@ where impl fmt::Display for Utf8Path where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { /// Format path into a [`String`] using the underlying [`str`] representation. /// @@ -1120,7 +1120,7 @@ where impl cmp::PartialEq for Utf8Path where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn eq(&self, other: &Utf8Path) -> bool { @@ -1128,11 +1128,11 @@ where } } -impl cmp::Eq for Utf8Path where T: for<'enc> Utf8Encoding<'enc> {} +impl cmp::Eq for Utf8Path where T: Utf8Encoding {} impl Hash for Utf8Path where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { fn hash(&self, h: &mut H) { T::hash(self.as_str(), h) @@ -1141,7 +1141,7 @@ where impl cmp::PartialOrd for Utf8Path where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn partial_cmp(&self, other: &Utf8Path) -> Option { @@ -1151,7 +1151,7 @@ where impl cmp::Ord for Utf8Path where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn cmp(&self, other: &Utf8Path) -> cmp::Ordering { @@ -1161,7 +1161,7 @@ where impl From<&Utf8Path> for Box> where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { /// Creates a boxed [`Utf8Path`] from a reference. /// @@ -1175,7 +1175,7 @@ where impl From>> for Box> where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { /// Creates a boxed [`Utf8Path`] from a clone-on-write pointer. /// @@ -1191,7 +1191,7 @@ where impl From> for Box> where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { /// Converts a [`Utf8PathBuf`] into a [Box]<[Utf8Path]>. /// @@ -1205,7 +1205,7 @@ where impl<'a, T> From<&'a Utf8Path> for Cow<'a, Utf8Path> where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { /// Creates a clone-on-write pointer from a reference to /// [`Utf8Path`]. @@ -1219,7 +1219,7 @@ where impl From> for Cow<'_, Utf8Path> where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { /// Creates a clone-on-write pointer from an owned /// instance of [`Utf8PathBuf`]. @@ -1233,7 +1233,7 @@ where impl<'a, T> From<&'a Utf8PathBuf> for Cow<'a, Utf8Path> where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { /// Creates a clone-on-write pointer from a reference to /// [`Utf8PathBuf`]. @@ -1247,7 +1247,7 @@ where impl From> for Arc> where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { /// Converts a [`Utf8PathBuf`] into an [Arc]<[Utf8Path]> by moving the [`Utf8PathBuf`] data /// into a new [`Arc`] buffer. @@ -1260,7 +1260,7 @@ where impl From<&Utf8Path> for Arc> where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { /// Converts a [`Utf8Path`] into an [`Arc`] by copying the [`Utf8Path`] data into a new [`Arc`] buffer. #[inline] @@ -1272,7 +1272,7 @@ where impl From> for Rc> where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { /// Converts a [`Utf8PathBuf`] into an [Rc]<[Utf8Path]> by moving the [`Utf8PathBuf`] data into /// a new [`Rc`] buffer. @@ -1285,7 +1285,7 @@ where impl From<&Utf8Path> for Rc> where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { /// Converts a [`Utf8Path`] into an [`Rc`] by copying the [`Utf8Path`] data into a new [`Rc`] buffer. #[inline] @@ -1297,7 +1297,7 @@ where impl<'a, T> IntoIterator for &'a Utf8Path where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { type IntoIter = Utf8Iter<'a, T>; type Item = &'a str; @@ -1310,7 +1310,7 @@ where impl ToOwned for Utf8Path where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { type Owned = Utf8PathBuf; @@ -1324,7 +1324,7 @@ macro_rules! impl_cmp { ($($lt:lifetime),* ; $lhs:ty, $rhs: ty) => { impl<$($lt,)* T> PartialEq<$rhs> for $lhs where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn eq(&self, other: &$rhs) -> bool { @@ -1334,7 +1334,7 @@ macro_rules! impl_cmp { impl<$($lt,)* T> PartialEq<$lhs> for $rhs where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn eq(&self, other: &$lhs) -> bool { @@ -1344,7 +1344,7 @@ macro_rules! impl_cmp { impl<$($lt,)* T> PartialOrd<$rhs> for $lhs where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn partial_cmp(&self, other: &$rhs) -> Option { @@ -1354,7 +1354,7 @@ macro_rules! impl_cmp { impl<$($lt,)* T> PartialOrd<$lhs> for $rhs where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn partial_cmp(&self, other: &$lhs) -> Option { @@ -1374,7 +1374,7 @@ macro_rules! impl_cmp_bytes { ($($lt:lifetime),* ; $lhs:ty, $rhs: ty) => { impl<$($lt,)* T> PartialEq<$rhs> for $lhs where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn eq(&self, other: &$rhs) -> bool { @@ -1384,7 +1384,7 @@ macro_rules! impl_cmp_bytes { impl<$($lt,)* T> PartialEq<$lhs> for $rhs where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn eq(&self, other: &$lhs) -> bool { @@ -1394,7 +1394,7 @@ macro_rules! impl_cmp_bytes { impl<$($lt,)* T> PartialOrd<$rhs> for $lhs where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn partial_cmp(&self, other: &$rhs) -> Option { @@ -1404,7 +1404,7 @@ macro_rules! impl_cmp_bytes { impl<$($lt,)* T> PartialOrd<$lhs> for $rhs where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn partial_cmp(&self, other: &$lhs) -> Option { @@ -1502,7 +1502,7 @@ mod std_conversions { impl TryAsRef> for OsStr where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn try_as_ref(&self) -> Option<&Utf8Path> { @@ -1512,7 +1512,7 @@ mod std_conversions { impl TryAsRef> for OsString where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn try_as_ref(&self) -> Option<&Utf8Path> { @@ -1522,7 +1522,7 @@ mod std_conversions { impl AsRef for Utf8Path where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn as_ref(&self) -> &OsStr { diff --git a/src/common/utf8/pathbuf.rs b/src/common/utf8/pathbuf.rs index 1f81150..ff22397 100644 --- a/src/common/utf8/pathbuf.rs +++ b/src/common/utf8/pathbuf.rs @@ -65,7 +65,7 @@ use crate::{CheckedPathError, Encoding, PathBuf, Utf8Encoding, Utf8Iter, Utf8Pat /// Which method works best depends on what kind of situation you're in. pub struct Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { /// Encoding associated with path buf pub(crate) _encoding: PhantomData, @@ -76,7 +76,7 @@ where impl Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { /// Allocates an empty `Utf8PathBuf`. /// @@ -468,7 +468,7 @@ where /// ``` pub fn from_bytes_path_buf(path_buf: PathBuf) -> Result where - U: for<'enc> Encoding<'enc>, + U: Encoding, { Ok(Self { _encoding: PhantomData, @@ -501,7 +501,7 @@ where /// ``` pub unsafe fn from_bytes_path_buf_unchecked(path_buf: PathBuf) -> Self where - U: for<'enc> Encoding<'enc>, + U: Encoding, { Self { _encoding: PhantomData, @@ -522,7 +522,7 @@ where /// ``` pub fn into_bytes_path_buf(self) -> PathBuf where - U: for<'enc> Encoding<'enc>, + U: Encoding, { PathBuf { _encoding: PhantomData, @@ -533,7 +533,7 @@ where impl Clone for Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn clone(&self) -> Self { @@ -546,7 +546,7 @@ where impl fmt::Debug for Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Utf8PathBuf") @@ -558,7 +558,7 @@ where impl AsRef<[u8]> for Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn as_ref(&self) -> &[u8] { @@ -568,7 +568,7 @@ where impl AsRef for Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn as_ref(&self) -> &str { @@ -578,7 +578,7 @@ where impl AsRef> for Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn as_ref(&self) -> &Utf8Path { @@ -588,7 +588,7 @@ where impl Borrow> for Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn borrow(&self) -> &Utf8Path { @@ -598,7 +598,7 @@ where impl Default for Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn default() -> Utf8PathBuf { @@ -608,7 +608,7 @@ where impl fmt::Display for Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Display::fmt(&self.inner, f) @@ -617,7 +617,7 @@ where impl Deref for Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { type Target = Utf8Path; @@ -627,11 +627,11 @@ where } } -impl Eq for Utf8PathBuf where T: for<'enc> Utf8Encoding<'enc> {} +impl Eq for Utf8PathBuf where T: Utf8Encoding {} impl PartialEq for Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { fn eq(&self, other: &Self) -> bool { self.components() == other.components() @@ -640,7 +640,7 @@ where impl Extend

for Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, P: AsRef>, { fn extend>(&mut self, iter: I) { @@ -650,7 +650,7 @@ where impl From>> for Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { fn from(boxed: Box>) -> Self { boxed.into_path_buf() @@ -659,7 +659,7 @@ where impl From<&V> for Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, V: ?Sized + AsRef, { /// Converts a borrowed [`str`] to a [`Utf8PathBuf`]. @@ -673,7 +673,7 @@ where impl From for Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { /// Converts a [`String`] into a [`Utf8PathBuf`] /// @@ -689,7 +689,7 @@ where impl From> for String where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { /// Converts a [`Utf8PathBuf`] into a [`String`] /// @@ -702,7 +702,7 @@ where impl FromStr for Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { type Err = core::convert::Infallible; @@ -714,7 +714,7 @@ where impl<'a, T> From>> for Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { /// Converts a clone-on-write pointer to an owned path. /// @@ -727,7 +727,7 @@ where impl FromIterator

for Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, P: AsRef>, { fn from_iter>(iter: I) -> Self { @@ -739,7 +739,7 @@ where impl Hash for Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { fn hash(&self, h: &mut H) { self.as_path().hash(h) @@ -748,7 +748,7 @@ where impl<'a, T> IntoIterator for &'a Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { type IntoIter = Utf8Iter<'a, T>; type Item = &'a str; @@ -761,7 +761,7 @@ where impl cmp::PartialOrd for Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn partial_cmp(&self, other: &Self) -> Option { @@ -771,7 +771,7 @@ where impl cmp::Ord for Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn cmp(&self, other: &Self) -> cmp::Ordering { @@ -804,7 +804,7 @@ mod std_conversions { impl From> for OsString where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn from(path_buf: Utf8PathBuf) -> Self { @@ -814,7 +814,7 @@ mod std_conversions { impl AsRef for Utf8PathBuf where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn as_ref(&self) -> &OsStr { diff --git a/src/platform.rs b/src/platform.rs index 99a7912..c16c890 100644 --- a/src/platform.rs +++ b/src/platform.rs @@ -72,27 +72,27 @@ mod non_utf8 { impl private::Sealed for PlatformEncoding {} - impl<'a> Encoding<'a> for PlatformEncoding { - type Components = >::Components; + impl Encoding for PlatformEncoding { + type Components<'a> = ::Components<'a>; fn label() -> &'static str { NativeEncoding::label() } - fn components(path: &'a [u8]) -> Self::Components { - >::components(path) + fn components(path: &[u8]) -> Self::Components<'_> { + ::components(path) } fn hash(path: &[u8], h: &mut H) { - >::hash(path, h) + ::hash(path, h) } fn push(current_path: &mut Vec, path: &[u8]) { - >::push(current_path, path); + ::push(current_path, path); } fn push_checked(current_path: &mut Vec, path: &[u8]) -> Result<(), CheckedPathError> { - >::push_checked(current_path, path) + ::push_checked(current_path, path) } } @@ -110,7 +110,7 @@ mod non_utf8 { impl Path where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Returns true if the encoding is the platform abstraction ([`PlatformEncoding`]), /// otherwise returns false. @@ -224,27 +224,27 @@ mod utf8 { impl private::Sealed for Utf8PlatformEncoding {} - impl<'a> Utf8Encoding<'a> for Utf8PlatformEncoding { - type Components = >::Components; + impl Utf8Encoding for Utf8PlatformEncoding { + type Components<'a> = ::Components<'a>; fn label() -> &'static str { Utf8NativeEncoding::label() } - fn components(path: &'a str) -> Self::Components { - >::components(path) + fn components(path: &str) -> Self::Components<'_> { + ::components(path) } fn hash(path: &str, h: &mut H) { - >::hash(path, h) + ::hash(path, h) } fn push(current_path: &mut String, path: &str) { - >::push(current_path, path); + ::push(current_path, path); } fn push_checked(current_path: &mut String, path: &str) -> Result<(), CheckedPathError> { - >::push_checked(current_path, path) + ::push_checked(current_path, path) } } @@ -262,7 +262,7 @@ mod utf8 { impl Utf8Path where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { /// Returns true if the encoding is the platform abstraction ([`Utf8PlatformEncoding`]), /// otherwise returns false. diff --git a/src/unix/non_utf8.rs b/src/unix/non_utf8.rs index cb462cf..4e9b4db 100644 --- a/src/unix/non_utf8.rs +++ b/src/unix/non_utf8.rs @@ -23,14 +23,14 @@ pub struct UnixEncoding; impl private::Sealed for UnixEncoding {} -impl<'a> Encoding<'a> for UnixEncoding { - type Components = UnixComponents<'a>; +impl Encoding for UnixEncoding { + type Components<'a> = UnixComponents<'a>; fn label() -> &'static str { "unix" } - fn components(path: &'a [u8]) -> Self::Components { + fn components(path: &[u8]) -> Self::Components<'_> { UnixComponents::new(path) } @@ -133,7 +133,7 @@ impl fmt::Display for UnixEncoding { impl Path where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Returns true if the encoding for the path is for Unix. /// diff --git a/src/unix/non_utf8/components.rs b/src/unix/non_utf8/components.rs index 2d4a4a4..99e6aa7 100644 --- a/src/unix/non_utf8/components.rs +++ b/src/unix/non_utf8/components.rs @@ -36,7 +36,7 @@ impl<'a> UnixComponents<'a> { /// ``` pub fn as_path(&self) -> &'a Path where - T: for<'enc> Encoding<'enc>, + T: Encoding, { Path::new(self.parser.remaining()) } @@ -72,7 +72,7 @@ impl AsRef<[u8]> for UnixComponents<'_> { impl AsRef> for UnixComponents<'_> where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn as_ref(&self) -> &Path { diff --git a/src/unix/non_utf8/components/component.rs b/src/unix/non_utf8/components/component.rs index 105a388..68a4c6b 100644 --- a/src/unix/non_utf8/components/component.rs +++ b/src/unix/non_utf8/components/component.rs @@ -17,7 +17,7 @@ impl UnixComponent<'_> { /// Returns path representing this specific component pub fn as_path(&self) -> &Path where - T: for<'enc> Encoding<'enc>, + T: Encoding, { Path::new(self.as_bytes()) } @@ -198,7 +198,7 @@ impl AsRef<[u8]> for UnixComponent<'_> { impl AsRef> for UnixComponent<'_> where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn as_ref(&self) -> &Path { diff --git a/src/unix/utf8.rs b/src/unix/utf8.rs index b79e147..b1d4a82 100644 --- a/src/unix/utf8.rs +++ b/src/unix/utf8.rs @@ -22,14 +22,14 @@ pub struct Utf8UnixEncoding; impl private::Sealed for Utf8UnixEncoding {} -impl<'a> Utf8Encoding<'a> for Utf8UnixEncoding { - type Components = Utf8UnixComponents<'a>; +impl Utf8Encoding for Utf8UnixEncoding { + type Components<'a> = Utf8UnixComponents<'a>; fn label() -> &'static str { "unix" } - fn components(path: &'a str) -> Self::Components { + fn components(path: &str) -> Self::Components<'_> { Utf8UnixComponents::new(path) } @@ -62,7 +62,7 @@ impl fmt::Display for Utf8UnixEncoding { impl Utf8Path where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { /// Returns true if the encoding for the path is for Unix. /// diff --git a/src/unix/utf8/components.rs b/src/unix/utf8/components.rs index 1978a09..8b8a59f 100644 --- a/src/unix/utf8/components.rs +++ b/src/unix/utf8/components.rs @@ -35,7 +35,7 @@ impl<'a> Utf8UnixComponents<'a> { /// ``` pub fn as_path(&self) -> &'a Utf8Path where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { Utf8Path::new(self.as_str()) } @@ -77,7 +77,7 @@ impl AsRef for Utf8UnixComponents<'_> { impl AsRef> for Utf8UnixComponents<'_> where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn as_ref(&self) -> &Utf8Path { diff --git a/src/unix/utf8/components/component.rs b/src/unix/utf8/components/component.rs index 851a961..521d671 100644 --- a/src/unix/utf8/components/component.rs +++ b/src/unix/utf8/components/component.rs @@ -106,7 +106,7 @@ impl Utf8UnixComponent<'_> { /// Returns path representing this specific component pub fn as_path(&self) -> &Utf8Path where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { Utf8Path::new(self.as_str()) } @@ -294,7 +294,7 @@ impl AsRef for Utf8UnixComponent<'_> { impl AsRef> for Utf8UnixComponent<'_> where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn as_ref(&self) -> &Utf8Path { diff --git a/src/windows/non_utf8.rs b/src/windows/non_utf8.rs index c569b9d..77e8a43 100644 --- a/src/windows/non_utf8.rs +++ b/src/windows/non_utf8.rs @@ -23,14 +23,14 @@ pub struct WindowsEncoding; impl private::Sealed for WindowsEncoding {} -impl<'a> Encoding<'a> for WindowsEncoding { - type Components = WindowsComponents<'a>; +impl Encoding for WindowsEncoding { + type Components<'a> = WindowsComponents<'a>; fn label() -> &'static str { "windows" } - fn components(path: &'a [u8]) -> Self::Components { + fn components(path: &[u8]) -> Self::Components<'_> { WindowsComponents::new(path) } @@ -239,7 +239,7 @@ impl fmt::Display for WindowsEncoding { impl Path where - T: for<'enc> Encoding<'enc>, + T: Encoding, { /// Returns true if the encoding for the path is for Windows. /// diff --git a/src/windows/non_utf8/components.rs b/src/windows/non_utf8/components.rs index da636d7..468f9e3 100644 --- a/src/windows/non_utf8/components.rs +++ b/src/windows/non_utf8/components.rs @@ -37,7 +37,7 @@ impl<'a> WindowsComponents<'a> { /// ``` pub fn as_path(&self) -> &'a Path where - T: for<'enc> Encoding<'enc>, + T: Encoding, { Path::new(self.parser.remaining()) } @@ -209,7 +209,7 @@ impl AsRef<[u8]> for WindowsComponents<'_> { impl AsRef> for WindowsComponents<'_> where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn as_ref(&self) -> &Path { diff --git a/src/windows/non_utf8/components/component.rs b/src/windows/non_utf8/components/component.rs index b754b1b..7b2ee57 100644 --- a/src/windows/non_utf8/components/component.rs +++ b/src/windows/non_utf8/components/component.rs @@ -25,7 +25,7 @@ impl<'a> WindowsComponent<'a> { /// Returns path representing this specific component pub fn as_path(&self) -> &Path where - T: for<'enc> Encoding<'enc>, + T: Encoding, { Path::new(self.as_bytes()) } @@ -249,7 +249,7 @@ impl AsRef<[u8]> for WindowsComponent<'_> { impl AsRef> for WindowsComponent<'_> where - T: for<'enc> Encoding<'enc>, + T: Encoding, { #[inline] fn as_ref(&self) -> &Path { diff --git a/src/windows/utf8.rs b/src/windows/utf8.rs index 35d8fa5..d7fe3f3 100644 --- a/src/windows/utf8.rs +++ b/src/windows/utf8.rs @@ -22,14 +22,14 @@ pub struct Utf8WindowsEncoding; impl private::Sealed for Utf8WindowsEncoding {} -impl<'a> Utf8Encoding<'a> for Utf8WindowsEncoding { - type Components = Utf8WindowsComponents<'a>; +impl Utf8Encoding for Utf8WindowsEncoding { + type Components<'a> = Utf8WindowsComponents<'a>; fn label() -> &'static str { "windows" } - fn components(path: &'a str) -> Self::Components { + fn components(path: &str) -> Self::Components<'_> { Utf8WindowsComponents::new(path) } @@ -62,7 +62,7 @@ impl fmt::Display for Utf8WindowsEncoding { impl Utf8Path where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { /// Returns true if the encoding for the path is for Windows. /// diff --git a/src/windows/utf8/components.rs b/src/windows/utf8/components.rs index 8e41ab8..6305e5f 100644 --- a/src/windows/utf8/components.rs +++ b/src/windows/utf8/components.rs @@ -36,7 +36,7 @@ impl<'a> Utf8WindowsComponents<'a> { /// ``` pub fn as_path(&self) -> &'a Utf8Path where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { Utf8Path::new(self.as_str()) } @@ -173,7 +173,7 @@ impl AsRef for Utf8WindowsComponents<'_> { impl AsRef> for Utf8WindowsComponents<'_> where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn as_ref(&self) -> &Utf8Path { diff --git a/src/windows/utf8/components/component.rs b/src/windows/utf8/components/component.rs index fe10876..955ac45 100644 --- a/src/windows/utf8/components/component.rs +++ b/src/windows/utf8/components/component.rs @@ -27,7 +27,7 @@ impl<'a> Utf8WindowsComponent<'a> { /// Returns path representing this specific component pub fn as_path(&self) -> &Utf8Path where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { Utf8Path::new(self.as_str()) } @@ -343,7 +343,7 @@ impl AsRef for Utf8WindowsComponent<'_> { impl AsRef> for Utf8WindowsComponent<'_> where - T: for<'enc> Utf8Encoding<'enc>, + T: Utf8Encoding, { #[inline] fn as_ref(&self) -> &Utf8Path {