5959//! over the place.
6060
6161use std:: collections:: { BTreeMap , HashMap , HashSet } ;
62- use std:: mem;
6362use std:: rc:: Rc ;
6463use std:: time:: { Duration , Instant } ;
6564
@@ -757,22 +756,8 @@ impl RemainingCandidates {
757756 ) -> Option < ( Summary , bool ) > {
758757 for b in self . remaining . iter ( ) {
759758 let b_id = b. package_id ( ) ;
760- // The `links` key in the manifest dictates that there's only one
761- // package in a dependency graph, globally, with that particular
762- // `links` key. If this candidate links to something that's already
763- // linked to by a different package then we've gotta skip this.
764- if let Some ( link) = b. links ( ) {
765- if let Some ( & a) = cx. links . get ( & link) {
766- if a != b_id {
767- conflicting_prev_active
768- . entry ( a)
769- . or_insert_with ( || ConflictReason :: Links ( link) ) ;
770- continue ;
771- }
772- }
773- }
774759
775- // Otherwise the condition for being a valid candidate relies on
760+ // The condition for being a valid candidate relies on
776761 // semver. Cargo dictates that you can't duplicate multiple
777762 // semver-compatible versions of a crate. For example we can't
778763 // simultaneously activate `foo 1.0.2` and `foo 1.2.0`. We can,
@@ -789,12 +774,27 @@ impl RemainingCandidates {
789774 }
790775 }
791776
777+ // Otherwise the `links` key in the manifest dictates that there's only one
778+ // package in a dependency graph, globally, with that particular
779+ // `links` key. If this candidate links to something that's already
780+ // linked to by a different package then we've gotta skip this.
781+ if let Some ( link) = b. links ( ) {
782+ if let Some ( & a) = cx. links . get ( & link) {
783+ if a != b_id {
784+ conflicting_prev_active
785+ . entry ( a)
786+ . or_insert_with ( || ConflictReason :: Links ( link) ) ;
787+ continue ;
788+ }
789+ }
790+ }
791+
792792 // Well if we made it this far then we've got a valid dependency. We
793793 // want this iterator to be inherently "peekable" so we don't
794794 // necessarily return the item just yet. Instead we stash it away to
795795 // get returned later, and if we replaced something then that was
796796 // actually the candidate to try first so we return that.
797- if let Some ( r) = mem :: replace ( & mut self . has_another , Some ( b. clone ( ) ) ) {
797+ if let Some ( r) = self . has_another . replace ( b. clone ( ) ) {
798798 return Some ( ( r, true ) ) ;
799799 }
800800 }
0 commit comments