Skip to content

Commit 504e938

Browse files
committed
Remove comparison trait implementations for generic RHS
1 parent 943cfd8 commit 504e938

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

src/c_string.rs

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -294,33 +294,19 @@ impl<const N: usize> Deref for CString<N> {
294294
}
295295
}
296296

297-
impl<const N: usize, T: AsRef<CStr>> PartialEq<T> for CString<N> {
297+
impl<const N: usize, const M: usize> PartialEq<CString<M>> for CString<N> {
298298
#[inline]
299-
fn eq(&self, rhs: &T) -> bool {
300-
self.as_c_str() == rhs.as_ref()
301-
}
302-
}
303-
304-
impl<const N: usize> PartialEq<CString<N>> for CStr {
305-
#[inline]
306-
fn eq(&self, rhs: &CString<N>) -> bool {
307-
self == rhs.as_c_str()
308-
}
309-
}
310-
311-
impl<const N: usize> PartialEq<CString<N>> for &CStr {
312-
#[inline]
313-
fn eq(&self, rhs: &CString<N>) -> bool {
314-
*self == rhs.as_c_str()
299+
fn eq(&self, rhs: &CString<M>) -> bool {
300+
self.as_c_str() == rhs.as_c_str()
315301
}
316302
}
317303

318304
impl<const N: usize> Eq for CString<N> {}
319305

320-
impl<const N: usize, T: AsRef<CStr>> PartialOrd<T> for CString<N> {
306+
impl<const N: usize, const M: usize> PartialOrd<CString<M>> for CString<N> {
321307
#[inline]
322-
fn partial_cmp(&self, rhs: &T) -> Option<Ordering> {
323-
self.as_c_str().partial_cmp(rhs.as_ref())
308+
fn partial_cmp(&self, rhs: &CString<M>) -> Option<Ordering> {
309+
self.as_c_str().partial_cmp(rhs.as_c_str())
324310
}
325311
}
326312

0 commit comments

Comments
 (0)