@@ -21,7 +21,6 @@ use syntax::ptr::P;
21
21
pub mod cargo;
22
22
pub mod comparisons;
23
23
pub mod conf;
24
- pub mod higher;
25
24
mod hir;
26
25
pub mod paths;
27
26
pub mod sugg;
@@ -82,6 +81,8 @@ macro_rules! if_let_chain {
82
81
} ;
83
82
}
84
83
84
+ pub mod higher;
85
+
85
86
/// Returns true if the two spans come from differing expansions (i.e. one is from a macro and one
86
87
/// isn't).
87
88
pub fn differing_macro_contexts ( lhs : Span , rhs : Span ) -> bool {
@@ -319,19 +320,6 @@ pub fn get_item_name(cx: &LateContext, expr: &Expr) -> Option<Name> {
319
320
}
320
321
}
321
322
322
- /// Checks if a `let` decl is from a `for` loop desugaring.
323
- pub fn is_from_for_desugar ( decl : & Decl ) -> bool {
324
- if_let_chain ! { [
325
- let DeclLocal ( ref loc) = decl. node,
326
- let Some ( ref expr) = loc. init,
327
- let ExprMatch ( _, _, MatchSource :: ForLoopDesugar ) = expr. node
328
- ] , {
329
- return true ;
330
- } }
331
- false
332
- }
333
-
334
-
335
323
/// Convert a span to a code snippet if available, otherwise use default.
336
324
///
337
325
/// # Example
@@ -706,25 +694,3 @@ pub fn same_tys<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, a: ty::Ty<'tcx>, b: ty::Ty
706
694
infcx. can_equate ( & new_a, & new_b) . is_ok ( )
707
695
} )
708
696
}
709
-
710
- /// Recover the essential nodes of a desugared for loop:
711
- /// `for pat in arg { body }` becomes `(pat, arg, body)`.
712
- pub fn recover_for_loop ( expr : & Expr ) -> Option < ( & Pat , & Expr , & Expr ) > {
713
- if_let_chain ! { [
714
- let ExprMatch ( ref iterexpr, ref arms, _) = expr. node,
715
- let ExprCall ( _, ref iterargs) = iterexpr. node,
716
- iterargs. len( ) == 1 && arms. len( ) == 1 && arms[ 0 ] . guard. is_none( ) ,
717
- let ExprLoop ( ref block, _) = arms[ 0 ] . body. node,
718
- block. stmts. is_empty( ) ,
719
- let Some ( ref loopexpr) = block. expr,
720
- let ExprMatch ( _, ref innerarms, MatchSource :: ForLoopDesugar ) = loopexpr. node,
721
- innerarms. len( ) == 2 && innerarms[ 0 ] . pats. len( ) == 1 ,
722
- let PatKind :: TupleStruct ( _, ref somepats, _) = innerarms[ 0 ] . pats[ 0 ] . node,
723
- somepats. len( ) == 1
724
- ] , {
725
- return Some ( ( & somepats[ 0 ] ,
726
- & iterargs[ 0 ] ,
727
- & innerarms[ 0 ] . body) ) ;
728
- } }
729
- None
730
- }
0 commit comments