Skip to content

Commit 32400a2

Browse files
committed
Fix lint about type repetition in bounds
Before Rust 1.15 ?Sized could not be used in where clauses. This reverts commit d2fe1d7 "Refactor for rust 1.6.0 compatibility" and updates other places that had used that style.
1 parent 6a3845a commit 32400a2

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/ascii_str.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ impl AsciiStr {
101101
/// assert_eq!(err.unwrap_err().valid_up_to(), 0);
102102
/// ```
103103
#[inline]
104-
pub fn from_ascii<B: ?Sized>(bytes: &B) -> Result<&AsciiStr, AsAsciiStrError>
104+
pub fn from_ascii<B>(bytes: &B) -> Result<&AsciiStr, AsAsciiStrError>
105105
where
106-
B: AsRef<[u8]>,
106+
B: AsRef<[u8]> + ?Sized,
107107
{
108108
bytes.as_ref().as_ascii_str()
109109
}
@@ -937,9 +937,9 @@ pub trait AsMutAsciiStr: AsAsciiStr {
937937
}
938938

939939
// These generic implementations mirror the generic implementations for AsRef<T> in core.
940-
impl<'a, T: ?Sized> AsAsciiStr for &'a T
940+
impl<'a, T> AsAsciiStr for &'a T
941941
where
942-
T: AsAsciiStr,
942+
T: AsAsciiStr + ?Sized,
943943
{
944944
type Inner = <T as AsAsciiStr>::Inner;
945945
fn slice_ascii<R>(&self, range: R) -> Result<&AsciiStr, AsAsciiStrError>
@@ -955,9 +955,9 @@ where
955955
}
956956
}
957957

958-
impl<'a, T: ?Sized> AsAsciiStr for &'a mut T
958+
impl<'a, T> AsAsciiStr for &'a mut T
959959
where
960-
T: AsAsciiStr,
960+
T: AsAsciiStr + ?Sized,
961961
{
962962
type Inner = <T as AsAsciiStr>::Inner;
963963
fn slice_ascii<R>(&self, range: R) -> Result<&AsciiStr, AsAsciiStrError>
@@ -973,9 +973,9 @@ where
973973
}
974974
}
975975

976-
impl<'a, T: ?Sized> AsMutAsciiStr for &'a mut T
976+
impl<'a, T> AsMutAsciiStr for &'a mut T
977977
where
978-
T: AsMutAsciiStr,
978+
T: AsMutAsciiStr + ?Sized,
979979
{
980980
fn slice_ascii_mut<R>(&mut self, range: R) -> Result<&mut AsciiStr, AsAsciiStrError>
981981
where

src/ascii_string.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -940,9 +940,9 @@ impl<'a> IntoAsciiString for &'a CStr {
940940
}
941941
}
942942

943-
impl<'a, B: ?Sized> IntoAsciiString for Cow<'a, B>
943+
impl<'a, B> IntoAsciiString for Cow<'a, B>
944944
where
945-
B: 'a + ToOwned,
945+
B: 'a + ToOwned + ?Sized,
946946
&'a B: IntoAsciiString,
947947
<B as ToOwned>::Owned: IntoAsciiString,
948948
{

0 commit comments

Comments
 (0)