@@ -553,53 +553,49 @@ impl VersionSpecifier {
553
553
// pypa/packaging disagrees: https://github.com/pypa/packaging/issues/617
554
554
other. as_ref ( ) >= this
555
555
}
556
- Operator :: GreaterThan => Self :: greater_than ( this, & other) ,
557
- Operator :: GreaterThanEqual => other. as_ref ( ) >= this,
558
- Operator :: LessThan => Self :: less_than ( this, & other) ,
559
- Operator :: LessThanEqual => other. as_ref ( ) <= this,
560
- }
561
- }
562
-
563
- fn less_than ( this : & Version , other : & Version ) -> bool {
564
- if other. epoch ( ) < this. epoch ( ) {
565
- return true ;
566
- }
567
-
568
- // The exclusive ordered comparison <V MUST NOT allow a pre-release of the specified
569
- // version unless the specified version is itself a pre-release. E.g., <3.1 should
570
- // not match 3.1.dev0, but should match both 3.0.dev0 and 3.0, while <3.1.dev1 does match
571
- // 3.1.dev0, 3.0.dev0 and 3.0.
572
- if version:: compare_release ( & this. release ( ) , & other. release ( ) ) == Ordering :: Equal
573
- && !this. any_prerelease ( )
574
- && other. any_prerelease ( )
575
- {
576
- return false ;
577
- }
556
+ Operator :: GreaterThan => {
557
+ if other. epoch ( ) > this. epoch ( ) {
558
+ return true ;
559
+ }
578
560
579
- other < this
580
- }
561
+ if version:: compare_release ( & this. release ( ) , & other. release ( ) ) == Ordering :: Equal {
562
+ // This special case is here so that, unless the specifier itself
563
+ // includes is a post-release version, that we do not accept
564
+ // post-release versions for the version mentioned in the specifier
565
+ // (e.g. >3.1 should not match 3.0.post0, but should match 3.2.post0).
566
+ if !this. is_post ( ) && other. is_post ( ) {
567
+ return false ;
568
+ }
581
569
582
- fn greater_than ( this : & Version , other : & Version ) -> bool {
583
- if other. epoch ( ) > this. epoch ( ) {
584
- return true ;
585
- }
570
+ // We already checked that self doesn't have a local version
571
+ if other. is_local ( ) {
572
+ return false ;
573
+ }
574
+ }
586
575
587
- if version:: compare_release ( & this. release ( ) , & other. release ( ) ) == Ordering :: Equal {
588
- // This special case is here so that, unless the specifier itself
589
- // includes is a post-release version, that we do not accept
590
- // post-release versions for the version mentioned in the specifier
591
- // (e.g. >3.1 should not match 3.0.post0, but should match 3.2.post0).
592
- if !this. is_post ( ) && other. is_post ( ) {
593
- return false ;
576
+ other. as_ref ( ) > this
594
577
}
578
+ Operator :: GreaterThanEqual => other. as_ref ( ) >= this,
579
+ Operator :: LessThan => {
580
+ if other. epoch ( ) < this. epoch ( ) {
581
+ return true ;
582
+ }
595
583
596
- // We already checked that self doesn't have a local version
597
- if other. is_local ( ) {
598
- return false ;
584
+ // The exclusive ordered comparison <V MUST NOT allow a pre-release of the specified
585
+ // version unless the specified version is itself a pre-release. E.g., <3.1 should
586
+ // not match 3.1.dev0, but should match both 3.0.dev0 and 3.0, while <3.1.dev1 does
587
+ // match 3.1.dev0, 3.0.dev0 and 3.0.
588
+ if version:: compare_release ( & this. release ( ) , & other. release ( ) ) == Ordering :: Equal
589
+ && !this. any_prerelease ( )
590
+ && other. any_prerelease ( )
591
+ {
592
+ return false ;
593
+ }
594
+
595
+ other. as_ref ( ) < this
599
596
}
597
+ Operator :: LessThanEqual => other. as_ref ( ) <= this,
600
598
}
601
-
602
- other > this
603
599
}
604
600
605
601
/// Whether this version specifier rejects versions below a lower cutoff.
0 commit comments