From b7fa37d03e39dbf4120c136c84f388d357a74779 Mon Sep 17 00:00:00 2001 From: Scott Olson Date: Wed, 6 Jan 2016 14:17:38 -0600 Subject: [PATCH] Fix pretty-printing for empty tuples in MIR. --- src/librustc/mir/repr.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/librustc/mir/repr.rs b/src/librustc/mir/repr.rs index b97d5939cf3..d90831c5dd1 100644 --- a/src/librustc/mir/repr.rs +++ b/src/librustc/mir/repr.rs @@ -804,10 +804,10 @@ fn fmt_tuple(fmt: &mut Formatter, name: &str, lvs: &[Operand]) -> fmt::Result { Vec => write!(fmt, "{:?}", lvs), Tuple => { - if lvs.len() == 1 { - write!(fmt, "({:?},)", lvs[0]) - } else { - fmt_tuple(fmt, "", lvs) + match lvs.len() { + 0 => write!(fmt, "()"), + 1 => write!(fmt, "({:?},)", lvs[0]), + _ => fmt_tuple(fmt, "", lvs), } }