@@ -17,17 +17,14 @@ enum ConflictStoreTrie {
17
17
impl ConflictStoreTrie {
18
18
/// Finds any known set of conflicts, if any,
19
19
/// which are activated in `cx` and pass the `filter` specified?
20
- fn find_conflicting < F > (
20
+ fn find_conflicting (
21
21
& self ,
22
22
cx : & Context ,
23
- filter : & F ,
24
- ) -> Option < & BTreeMap < PackageId , ConflictReason > >
25
- where
26
- for < ' r > F : Fn ( & ' r & BTreeMap < PackageId , ConflictReason > ) -> bool ,
27
- {
23
+ must_contain : Option < PackageId > ,
24
+ ) -> Option < & BTreeMap < PackageId , ConflictReason > > {
28
25
match self {
29
26
ConflictStoreTrie :: Leaf ( c) => {
30
- if filter ( & c ) {
27
+ if must_contain . map ( |f| c . contains_key ( & f ) ) . unwrap_or ( true ) {
31
28
// is_conflicting checks that all the elements are active,
32
29
// but we have checked each one by the recursion of this function.
33
30
debug_assert ! ( cx. is_conflicting( None , c) ) ;
@@ -40,7 +37,7 @@ impl ConflictStoreTrie {
40
37
for ( & pid, store) in m {
41
38
// if the key is active then we need to check all of the corresponding subTrie.
42
39
if cx. is_active ( pid) {
43
- if let Some ( o) = store. find_conflicting ( cx, filter ) {
40
+ if let Some ( o) = store. find_conflicting ( cx, must_contain ) {
44
41
return Some ( o) ;
45
42
}
46
43
} // else, if it is not active then there is no way any of the corresponding
@@ -134,23 +131,22 @@ impl ConflictCache {
134
131
}
135
132
/// Finds any known set of conflicts, if any,
136
133
/// which are activated in `cx` and pass the `filter` specified?
137
- pub fn find_conflicting < F > (
134
+ pub fn find_conflicting (
138
135
& self ,
139
136
cx : & Context ,
140
137
dep : & Dependency ,
141
- filter : F ,
142
- ) -> Option < & BTreeMap < PackageId , ConflictReason > >
143
- where
144
- for < ' r > F : Fn ( & ' r & BTreeMap < PackageId , ConflictReason > ) -> bool ,
145
- {
146
- self . con_from_dep . get ( dep) ?. find_conflicting ( cx, & filter)
138
+ must_contain : Option < PackageId > ,
139
+ ) -> Option < & BTreeMap < PackageId , ConflictReason > > {
140
+ self . con_from_dep
141
+ . get ( dep) ?
142
+ . find_conflicting ( cx, must_contain)
147
143
}
148
144
pub fn conflicting (
149
145
& self ,
150
146
cx : & Context ,
151
147
dep : & Dependency ,
152
148
) -> Option < & BTreeMap < PackageId , ConflictReason > > {
153
- self . find_conflicting ( cx, dep, |_| true )
149
+ self . find_conflicting ( cx, dep, None )
154
150
}
155
151
156
152
/// Add to the cache a conflict of the form:
0 commit comments