@@ -751,20 +751,24 @@ impl<'cfg> Source for RegistrySource<'cfg> {
751
751
req. update_precise ( & requested) ;
752
752
}
753
753
754
+ let mut called = false ;
755
+ let callback = & mut |s| {
756
+ called = true ;
757
+ f ( s) ;
758
+ } ;
759
+
754
760
// If this is a locked dependency, then it came from a lock file and in
755
761
// theory the registry is known to contain this version. If, however, we
756
762
// come back with no summaries, then our registry may need to be
757
763
// updated, so we fall back to performing a lazy update.
758
764
if kind == QueryKind :: Exact && req. is_locked ( ) && !self . ops . is_updated ( ) {
759
765
debug ! ( "attempting query without update" ) ;
760
- let mut called = false ;
761
766
ready ! ( self
762
767
. index
763
768
. query_inner( dep. package_name( ) , & req, & mut * self . ops, & mut |s| {
764
769
if dep. matches( s. as_summary( ) ) {
765
770
// We are looking for a package from a lock file so we do not care about yank
766
- called = true ;
767
- f( s) ;
771
+ callback( s)
768
772
}
769
773
} , ) ) ?;
770
774
if called {
@@ -775,7 +779,6 @@ impl<'cfg> Source for RegistrySource<'cfg> {
775
779
Poll :: Pending
776
780
}
777
781
} else {
778
- let mut called = false ;
779
782
ready ! ( self
780
783
. index
781
784
. query_inner( dep. package_name( ) , & req, & mut * self . ops, & mut |s| {
@@ -789,8 +792,7 @@ impl<'cfg> Source for RegistrySource<'cfg> {
789
792
if matched
790
793
&& ( !s. is_yanked( ) || self . yanked_whitelist. contains( & s. package_id( ) ) )
791
794
{
792
- f( s) ;
793
- called = true ;
795
+ callback( s) ;
794
796
}
795
797
} ) ) ?;
796
798
if called {
0 commit comments