-/// Return the list of condition expressions and the list of blocks in a
-/// sequence of `if/else`.
-/// Eg. would return `([a, b], [c, d, e])` for the expression
-/// `if a { c } else if b { d } else { e }`.
-fn if_sequence(mut expr: &Expr) -> (SmallVec<[&Expr; 1]>, SmallVec<[&Block; 1]>) {
- let mut conds = SmallVec::new();
- let mut blocks: SmallVec<[&Block; 1]> = SmallVec::new();
-
- while let ExprKind::If(ref cond, ref then_expr, ref else_expr) = expr.node {
- conds.push(&**cond);
- if let ExprKind::Block(ref block, _) = then_expr.node {
- blocks.push(block);
- } else {
- panic!("ExprKind::If node is not an ExprKind::Block");
- }
-
- if let Some(ref else_expr) = *else_expr {
- expr = else_expr;
- } else {
- break;
- }
- }
-
- // final `else {..}`
- if !blocks.is_empty() {
- if let ExprKind::Block(ref block, _) = expr.node {
- blocks.push(&**block);
- }
- }
-
- (conds, blocks)
-}
-
-/// Return the list of bindings in a pattern.
-fn bindings<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat) -> FxHashMap<LocalInternedString, Ty<'tcx>> {
- fn bindings_impl<'a, 'tcx>(
- cx: &LateContext<'a, 'tcx>,
- pat: &Pat,
- map: &mut FxHashMap<LocalInternedString, Ty<'tcx>>,
- ) {
+/// Returns the list of bindings in a pattern.
+fn bindings<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat) -> FxHashMap<Symbol, Ty<'tcx>> {
+ fn bindings_impl<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat, map: &mut FxHashMap<Symbol, Ty<'tcx>>) {