or-patterns: syntax: adjust derive, format, and building.

This commit is contained in:
Mazdak Farrokhzad
2019-08-28 01:16:35 +02:00
parent 424492acc8
commit 76625eb0cc
6 changed files with 14 additions and 18 deletions

View File

@@ -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