1
1
use std:: collections:: { HashMap , HashSet } ;
2
- use std:: task:: Poll ;
2
+ use std:: task:: { ready , Poll } ;
3
3
4
4
use crate :: core:: PackageSet ;
5
5
use crate :: core:: { Dependency , PackageId , QueryKind , Source , SourceId , SourceMap , Summary } ;
@@ -482,10 +482,7 @@ impl<'cfg> PackageRegistry<'cfg> {
482
482
for & s in self . overrides . iter ( ) {
483
483
let src = self . sources . get_mut ( s) . unwrap ( ) ;
484
484
let dep = Dependency :: new_override ( dep. package_name ( ) , s) ;
485
- let mut results = match src. query_vec ( & dep, QueryKind :: Exact ) {
486
- Poll :: Ready ( results) => results?,
487
- Poll :: Pending => return Poll :: Pending ,
488
- } ;
485
+ let mut results = ready ! ( src. query_vec( & dep, QueryKind :: Exact ) ) ?;
489
486
if !results. is_empty ( ) {
490
487
return Poll :: Ready ( Ok ( Some ( results. remove ( 0 ) ) ) ) ;
491
488
}
@@ -580,10 +577,7 @@ impl<'cfg> Registry for PackageRegistry<'cfg> {
580
577
assert ! ( self . patches_locked) ;
581
578
let ( override_summary, n, to_warn) = {
582
579
// Look for an override and get ready to query the real source.
583
- let override_summary = match self . query_overrides ( dep) {
584
- Poll :: Ready ( override_summary) => override_summary?,
585
- Poll :: Pending => return Poll :: Pending ,
586
- } ;
580
+ let override_summary = ready ! ( self . query_overrides( dep) ) ?;
587
581
588
582
// Next up on our list of candidates is to check the `[patch]`
589
583
// section of the manifest. Here we look through all patches
@@ -880,23 +874,17 @@ fn summary_for_patch(
880
874
// No summaries found, try to help the user figure out what is wrong.
881
875
if let Some ( locked) = locked {
882
876
// Since the locked patch did not match anything, try the unlocked one.
883
- let orig_matches = match source. query_vec ( orig_patch, QueryKind :: Exact ) {
884
- Poll :: Pending => return Poll :: Pending ,
885
- Poll :: Ready ( deps) => deps,
886
- }
887
- . unwrap_or_else ( |e| {
888
- log:: warn!(
889
- "could not determine unlocked summaries for dep {:?}: {:?}" ,
890
- orig_patch,
891
- e
892
- ) ;
893
- Vec :: new ( )
894
- } ) ;
877
+ let orig_matches =
878
+ ready ! ( source. query_vec( orig_patch, QueryKind :: Exact ) ) . unwrap_or_else ( |e| {
879
+ log:: warn!(
880
+ "could not determine unlocked summaries for dep {:?}: {:?}" ,
881
+ orig_patch,
882
+ e
883
+ ) ;
884
+ Vec :: new ( )
885
+ } ) ;
895
886
896
- let summary = match summary_for_patch ( orig_patch, & None , orig_matches, source) {
897
- Poll :: Pending => return Poll :: Pending ,
898
- Poll :: Ready ( summary) => summary?,
899
- } ;
887
+ let summary = ready ! ( summary_for_patch( orig_patch, & None , orig_matches, source) ) ?;
900
888
901
889
// The unlocked version found a match. This returns a value to
902
890
// indicate that this entry should be unlocked.
@@ -905,18 +893,15 @@ fn summary_for_patch(
905
893
// Try checking if there are *any* packages that match this by name.
906
894
let name_only_dep = Dependency :: new_override ( orig_patch. package_name ( ) , orig_patch. source_id ( ) ) ;
907
895
908
- let name_summaries = match source. query_vec ( & name_only_dep, QueryKind :: Exact ) {
909
- Poll :: Pending => return Poll :: Pending ,
910
- Poll :: Ready ( deps) => deps,
911
- }
912
- . unwrap_or_else ( |e| {
913
- log:: warn!(
914
- "failed to do name-only summary query for {:?}: {:?}" ,
915
- name_only_dep,
916
- e
917
- ) ;
918
- Vec :: new ( )
919
- } ) ;
896
+ let name_summaries =
897
+ ready ! ( source. query_vec( & name_only_dep, QueryKind :: Exact ) ) . unwrap_or_else ( |e| {
898
+ log:: warn!(
899
+ "failed to do name-only summary query for {:?}: {:?}" ,
900
+ name_only_dep,
901
+ e
902
+ ) ;
903
+ Vec :: new ( )
904
+ } ) ;
920
905
let mut vers = name_summaries
921
906
. iter ( )
922
907
. map ( |summary| summary. version ( ) )
0 commit comments