diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index e894fd17ff5..dc6cbfcf6ad 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -537,9 +537,9 @@ impl<'a> ExtCtxt<'a> { let err_expr = self.expr(sp, ast::ExprKind::Ret(Some(err_inner_expr))); // `Ok(__try_var) => __try_var` - let ok_arm = self.arm(sp, vec![ok_pat], binding_expr); + let ok_arm = self.arm(sp, ok_pat, binding_expr); // `Err(__try_var) => return Err(__try_var)` - let err_arm = self.arm(sp, vec![err_pat], err_expr); + let err_arm = self.arm(sp, err_pat, err_expr); // `match head { Ok() => ..., Err() => ... }` self.expr_match(sp, head, vec![ok_arm, err_arm]) @@ -606,10 +606,10 @@ impl<'a> ExtCtxt<'a> { self.pat_tuple_struct(span, path, vec![pat]) } - pub fn arm(&self, span: Span, pats: Vec>, expr: P) -> ast::Arm { + pub fn arm(&self, span: Span, pat: P, expr: P) -> ast::Arm { ast::Arm { attrs: vec![], - pats, + pat, guard: None, body: expr, span, @@ -618,7 +618,7 @@ impl<'a> ExtCtxt<'a> { } pub fn arm_unreachable(&self, span: Span) -> ast::Arm { - self.arm(span, vec![self.pat_wild(span)], self.expr_unreachable(span)) + self.arm(span, self.pat_wild(span), self.expr_unreachable(span)) } pub fn expr_match(&self, span: Span, arg: P, arms: Vec) -> P { diff --git a/src/libsyntax_ext/deriving/cmp/ord.rs b/src/libsyntax_ext/deriving/cmp/ord.rs index 55687c3175b..1f4f5aa3709 100644 --- a/src/libsyntax_ext/deriving/cmp/ord.rs +++ b/src/libsyntax_ext/deriving/cmp/ord.rs @@ -95,11 +95,9 @@ pub fn cs_cmp(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> P< cx.expr_call_global(span, cmp_path.clone(), args) }; - let eq_arm = cx.arm(span, - vec![cx.pat_path(span, equals_path.clone())], - old); + let eq_arm = cx.arm(span, cx.pat_path(span, equals_path.clone()), old); let neq_arm = cx.arm(span, - vec![cx.pat_ident(span, test_id)], + cx.pat_ident(span, test_id), cx.expr_ident(span, test_id)); cx.expr_match(span, new, vec![eq_arm, neq_arm]) diff --git a/src/libsyntax_ext/deriving/cmp/partial_ord.rs b/src/libsyntax_ext/deriving/cmp/partial_ord.rs index 740b92a9b79..debdc300e64 100644 --- a/src/libsyntax_ext/deriving/cmp/partial_ord.rs +++ b/src/libsyntax_ext/deriving/cmp/partial_ord.rs @@ -160,10 +160,10 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_ }; let eq_arm = cx.arm(span, - vec![cx.pat_some(span, cx.pat_path(span, ordering.clone()))], + cx.pat_some(span, cx.pat_path(span, ordering.clone())), old); let neq_arm = cx.arm(span, - vec![cx.pat_ident(span, test_id)], + cx.pat_ident(span, test_id), cx.expr_ident(span, test_id)); cx.expr_match(span, new, vec![eq_arm, neq_arm]) diff --git a/src/libsyntax_ext/deriving/decodable.rs b/src/libsyntax_ext/deriving/decodable.rs index 9b6f8518de0..d3d604b7252 100644 --- a/src/libsyntax_ext/deriving/decodable.rs +++ b/src/libsyntax_ext/deriving/decodable.rs @@ -119,9 +119,7 @@ fn decodable_substructure(cx: &mut ExtCtxt<'_>, vec![idx, exprdecode.clone()])) }); - arms.push(cx.arm(v_span, - vec![cx.pat_lit(v_span, cx.expr_usize(v_span, i))], - decoded)); + arms.push(cx.arm(v_span, cx.pat_lit(v_span, cx.expr_usize(v_span, i)), decoded)); } arms.push(cx.arm_unreachable(trait_span)); diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs index 6fd763f5a91..893d89f06a1 100644 --- a/src/libsyntax_ext/deriving/generic/mod.rs +++ b/src/libsyntax_ext/deriving/generic/mod.rs @@ -1071,7 +1071,7 @@ impl<'a> MethodDef<'a> { for (arg_expr, pat) in self_args.iter().zip(patterns) { body = cx.expr_match(trait_.span, arg_expr.clone(), - vec![cx.arm(trait_.span, vec![pat.clone()], body)]) + vec![cx.arm(trait_.span, pat.clone(), body)]) } body @@ -1311,7 +1311,7 @@ impl<'a> MethodDef<'a> { nonself_args, &substructure); - cx.arm(sp, vec![single_pat], arm_expr) + cx.arm(sp, single_pat, arm_expr) }) .collect(); @@ -1337,7 +1337,7 @@ impl<'a> MethodDef<'a> { _ => None, }; if let Some(arm) = default { - match_arms.push(cx.arm(sp, vec![cx.pat_wild(sp)], arm)); + match_arms.push(cx.arm(sp, cx.pat_wild(sp), arm)); } // We will usually need the catch-all after matching the diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs index 47394c02b41..9012bafad41 100644 --- a/src/libsyntax_ext/format.rs +++ b/src/libsyntax_ext/format.rs @@ -716,7 +716,7 @@ impl<'a, 'b> Context<'a, 'b> { // But the nested match expression is proved to perform not as well // as series of let's; the first approach does. let pat = self.ecx.pat_tuple(self.fmtsp, pats); - let arm = self.ecx.arm(self.fmtsp, vec![pat], args_array); + let arm = self.ecx.arm(self.fmtsp, pat, args_array); let head = self.ecx.expr(self.fmtsp, ast::ExprKind::Tup(heads)); let result = self.ecx.expr_match(self.fmtsp, head, vec![arm]);