@@ -203,49 +203,6 @@ pub fn block_query<P>(b: &ast::Block, p: P) -> bool where P: FnMut(&ast::Expr) -
203
203
return v. flag ;
204
204
}
205
205
206
- /// K: Eq + Hash<S>, V, S, H: Hasher<S>
207
- ///
208
- /// Determines whether there exists a path from `source` to `destination`. The
209
- /// graph is defined by the `edges_map`, which maps from a node `S` to a list of
210
- /// its adjacent nodes `T`.
211
- ///
212
- /// Efficiency note: This is implemented in an inefficient way because it is
213
- /// typically invoked on very small graphs. If the graphs become larger, a more
214
- /// efficient graph representation and algorithm would probably be advised.
215
- pub fn can_reach < T , S > ( edges_map : & HashMap < T , Vec < T > , S > , source : T ,
216
- destination : T ) -> bool
217
- where S : HashState , T : Hash + Eq + Clone ,
218
- {
219
- if source == destination {
220
- return true ;
221
- }
222
-
223
- // Do a little breadth-first-search here. The `queue` list
224
- // doubles as a way to detect if we've seen a particular FR
225
- // before. Note that we expect this graph to be an *extremely
226
- // shallow* tree.
227
- let mut queue = vec ! ( source) ;
228
- let mut i = 0 ;
229
- while i < queue. len ( ) {
230
- match edges_map. get ( & queue[ i] ) {
231
- Some ( edges) => {
232
- for target in edges {
233
- if * target == destination {
234
- return true ;
235
- }
236
-
237
- if !queue. iter ( ) . any ( |x| x == target) {
238
- queue. push ( ( * target) . clone ( ) ) ;
239
- }
240
- }
241
- }
242
- None => { }
243
- }
244
- i += 1 ;
245
- }
246
- return false ;
247
- }
248
-
249
206
/// Memoizes a one-argument closure using the given RefCell containing
250
207
/// a type implementing MutableMap to serve as a cache.
251
208
///
0 commit comments