File tree Expand file tree Collapse file tree 1 file changed +10
-12
lines changed Expand file tree Collapse file tree 1 file changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -319,18 +319,6 @@ impl<const N: usize, T: AsRef<CStr>> PartialOrd<T> for CString<N> {
319
319
}
320
320
}
321
321
322
- impl < const N : usize > PartialOrd < CString < N > > for CStr {
323
- fn partial_cmp ( & self , rhs : & CString < N > ) -> Option < Ordering > {
324
- self . as_ref ( ) . partial_cmp ( rhs. as_c_str ( ) )
325
- }
326
- }
327
-
328
- impl < const N : usize > PartialOrd < CString < N > > for & CStr {
329
- fn partial_cmp ( & self , rhs : & CString < N > ) -> Option < Ordering > {
330
- self . as_ref ( ) . partial_cmp ( rhs. as_c_str ( ) )
331
- }
332
- }
333
-
334
322
impl < const N : usize > Ord for CString < N > {
335
323
fn cmp ( & self , rhs : & Self ) -> Ordering {
336
324
self . as_c_str ( ) . cmp ( rhs. as_c_str ( ) )
@@ -569,6 +557,16 @@ mod tests {
569
557
. partial_cmp( & c"a" ) ,
570
558
Some ( Ordering :: Greater )
571
559
) ;
560
+
561
+ assert_eq ! ( c"" . partial_cmp( & CString :: <1 >:: new( ) ) , Some ( Ordering :: Equal ) ) ;
562
+ assert_eq ! (
563
+ c"a" . partial_cmp( & CString :: <2 >:: from_bytes_with_nul( b"b\0 " ) . unwrap( ) ) ,
564
+ Some ( Ordering :: Less )
565
+ ) ;
566
+ assert_eq ! (
567
+ c"b" . partial_cmp( & CString :: <2 >:: from_bytes_with_nul( b"a\0 " ) . unwrap( ) ) ,
568
+ Some ( Ordering :: Greater )
569
+ ) ;
572
570
}
573
571
}
574
572
}
You can’t perform that action at this time.
0 commit comments