@@ -29,21 +29,20 @@ pub trait Source {
29
29
fn requires_precise ( & self ) -> bool ;
30
30
31
31
/// Attempts to find the packages that match a dependency request.
32
- fn query ( & mut self , dep : & Dependency , f : & mut dyn FnMut ( Summary ) ) -> Poll < CargoResult < ( ) > > ;
33
-
34
- /// Attempts to find the packages that are close to a dependency request.
35
- /// Each source gets to define what `close` means for it.
32
+ ///
33
+ /// When fuzzy, each source gets to define what `close` means for it.
36
34
/// Path/Git sources may return all dependencies that are at that URI,
37
35
/// whereas an `Index` source may return dependencies that have the same canonicalization.
38
- fn fuzzy_query (
36
+ fn query (
39
37
& mut self ,
40
38
dep : & Dependency ,
39
+ fuzzy : bool ,
41
40
f : & mut dyn FnMut ( Summary ) ,
42
41
) -> Poll < CargoResult < ( ) > > ;
43
42
44
43
fn query_vec ( & mut self , dep : & Dependency ) -> Poll < CargoResult < Vec < Summary > > > {
45
44
let mut ret = Vec :: new ( ) ;
46
- self . query ( dep, & mut |s| ret. push ( s) ) . map_ok ( |_| ret)
45
+ self . query ( dep, false , & mut |s| ret. push ( s) ) . map_ok ( |_| ret)
47
46
}
48
47
49
48
/// Ensure that the source is fully up-to-date for the current session on the next query.
@@ -142,17 +141,13 @@ impl<'a, T: Source + ?Sized + 'a> Source for Box<T> {
142
141
}
143
142
144
143
/// Forwards to `Source::query`.
145
- fn query ( & mut self , dep : & Dependency , f : & mut dyn FnMut ( Summary ) ) -> Poll < CargoResult < ( ) > > {
146
- ( * * self ) . query ( dep, f)
147
- }
148
-
149
- /// Forwards to `Source::query`.
150
- fn fuzzy_query (
144
+ fn query (
151
145
& mut self ,
152
146
dep : & Dependency ,
147
+ fuzzy : bool ,
153
148
f : & mut dyn FnMut ( Summary ) ,
154
149
) -> Poll < CargoResult < ( ) > > {
155
- ( * * self ) . fuzzy_query ( dep, f)
150
+ ( * * self ) . query ( dep, fuzzy , f)
156
151
}
157
152
158
153
fn invalidate_cache ( & mut self ) {
@@ -216,16 +211,13 @@ impl<'a, T: Source + ?Sized + 'a> Source for &'a mut T {
216
211
( * * self ) . requires_precise ( )
217
212
}
218
213
219
- fn query ( & mut self , dep : & Dependency , f : & mut dyn FnMut ( Summary ) ) -> Poll < CargoResult < ( ) > > {
220
- ( * * self ) . query ( dep, f)
221
- }
222
-
223
- fn fuzzy_query (
214
+ fn query (
224
215
& mut self ,
225
216
dep : & Dependency ,
217
+ fuzzy : bool ,
226
218
f : & mut dyn FnMut ( Summary ) ,
227
219
) -> Poll < CargoResult < ( ) > > {
228
- ( * * self ) . fuzzy_query ( dep, f)
220
+ ( * * self ) . query ( dep, fuzzy , f)
229
221
}
230
222
231
223
fn invalidate_cache ( & mut self ) {
0 commit comments