File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed
Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -488,10 +488,11 @@ where
488488
489489/// Ensure set elements are lexicographically ordered using [`DerOrd`].
490490fn check_der_ordering < T : DerOrd > ( a : & T , b : & T ) -> Result < ( ) , Error > {
491- match a. der_cmp ( b) ? {
492- Ordering :: Less | Ordering :: Equal => Ok ( ( ) ) ,
493- Ordering :: Greater => Err ( ErrorKind :: SetOrdering . into ( ) ) ,
491+ if a. der_cmp ( b) ? == Ordering :: Greater {
492+ return Err ( ErrorKind :: SetOrdering . into ( ) ) ;
494493 }
494+
495+ Ok ( ( ) )
495496}
496497
497498/// Sort a mut slice according to its [`DerOrd`], returning any errors which
@@ -509,12 +510,11 @@ fn der_sort<T: DerOrd>(slice: &mut [T]) -> Result<(), Error> {
509510 let mut j = i;
510511
511512 while j > 0 {
512- match slice[ j - 1 ] . der_cmp ( & slice[ j] ) ? {
513- Ordering :: Less | Ordering :: Equal => break ,
514- Ordering :: Greater => {
515- slice. swap ( j - 1 , j) ;
516- j -= 1 ;
517- }
513+ if slice[ j - 1 ] . der_cmp ( & slice[ j] ) ? == Ordering :: Greater {
514+ slice. swap ( j - 1 , j) ;
515+ j -= 1 ;
516+ } else {
517+ break ;
518518 }
519519 }
520520 }
Original file line number Diff line number Diff line change @@ -265,6 +265,11 @@ pub enum ErrorKind {
265265 } ,
266266
267267 /// `SET` cannot contain duplicates.
268+ // TODO(tarcieri): remove this in the next breaking release
269+ #[ deprecated(
270+ since = "0.8.1" ,
271+ note = "per X.680, 27.3 NOTE 3 duplicates are allowed"
272+ ) ]
268273 SetDuplicate ,
269274
270275 /// `SET` ordering error: items not in canonical order.
@@ -376,6 +381,7 @@ impl fmt::Display for ErrorKind {
376381 ErrorKind :: OidUnknown { oid } => {
377382 write ! ( f, "unknown/unsupported OID: {oid}" )
378383 }
384+ #[ allow( deprecated) ]
379385 ErrorKind :: SetDuplicate => write ! ( f, "SET OF contains duplicate" ) ,
380386 ErrorKind :: SetOrdering => write ! ( f, "SET OF ordering error" ) ,
381387 ErrorKind :: Overflow => write ! ( f, "integer overflow" ) ,
You can’t perform that action at this time.
0 commit comments