@@ -31,7 +31,6 @@ use core::str::next_code_point;
3131use ascii:: * ;
3232use borrow:: Cow ;
3333use char;
34- use cmp;
3534use fmt;
3635use hash:: { Hash , Hasher } ;
3736use iter:: FromIterator ;
@@ -375,6 +374,7 @@ impl Extend<CodePoint> for Wtf8Buf {
375374///
376375/// Similar to `&str`, but can additionally contain surrogate code points
377376/// if they’re not in a surrogate pair.
377+ #[ derive( Eq , Ord , PartialEq , PartialOrd ) ]
378378pub struct Wtf8 {
379379 bytes : [ u8 ]
380380}
@@ -383,36 +383,6 @@ impl AsInner<[u8]> for Wtf8 {
383383 fn as_inner ( & self ) -> & [ u8 ] { & self . bytes }
384384}
385385
386- // FIXME: https://github.com/rust-lang/rust/issues/18805
387- impl PartialEq for Wtf8 {
388- fn eq ( & self , other : & Wtf8 ) -> bool { self . bytes . eq ( & other. bytes ) }
389- }
390-
391- // FIXME: https://github.com/rust-lang/rust/issues/18805
392- impl Eq for Wtf8 { }
393-
394- // FIXME: https://github.com/rust-lang/rust/issues/18738
395- impl PartialOrd for Wtf8 {
396- #[ inline]
397- fn partial_cmp ( & self , other : & Wtf8 ) -> Option < cmp:: Ordering > {
398- self . bytes . partial_cmp ( & other. bytes )
399- }
400- #[ inline]
401- fn lt ( & self , other : & Wtf8 ) -> bool { self . bytes . lt ( & other. bytes ) }
402- #[ inline]
403- fn le ( & self , other : & Wtf8 ) -> bool { self . bytes . le ( & other. bytes ) }
404- #[ inline]
405- fn gt ( & self , other : & Wtf8 ) -> bool { self . bytes . gt ( & other. bytes ) }
406- #[ inline]
407- fn ge ( & self , other : & Wtf8 ) -> bool { self . bytes . ge ( & other. bytes ) }
408- }
409-
410- // FIXME: https://github.com/rust-lang/rust/issues/18738
411- impl Ord for Wtf8 {
412- #[ inline]
413- fn cmp ( & self , other : & Wtf8 ) -> cmp:: Ordering { self . bytes . cmp ( & other. bytes ) }
414- }
415-
416386/// Format the slice with double quotes,
417387/// and surrogates as `\u` followed by four hexadecimal digits.
418388/// Example: `"a\u{D800}"` for a slice with code points [U+0061, U+D800]
0 commit comments