From 83dfb422fe71979914d3db67db135e160ab29dcd Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Tue, 21 Jan 2020 13:37:02 -0800 Subject: [PATCH] Don't break first line --- src/librustc_mir/dataflow/generic/graphviz.rs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/librustc_mir/dataflow/generic/graphviz.rs b/src/librustc_mir/dataflow/generic/graphviz.rs index 8bf5852f003f1..f70564d401913 100644 --- a/src/librustc_mir/dataflow/generic/graphviz.rs +++ b/src/librustc_mir/dataflow/generic/graphviz.rs @@ -610,13 +610,6 @@ where let mut line_break_inserted = false; for idx in elems { - if first { - first = false; - } else { - write!(w, "{}", sep)?; - curr_line_width += sep_width; - } - buf.clear(); analysis.pretty_print_idx(&mut buf, idx)?; let idx_str = @@ -624,11 +617,18 @@ where let escaped = dot::escape_html(idx_str); let escaped_width = escaped.chars().count(); - if let Some(line_break) = &line_break { - if curr_line_width + sep_width + escaped_width > line_break.limit { - write!(w, "{}", line_break.sequence)?; - line_break_inserted = true; - curr_line_width = 0; + if first { + first = false; + } else { + write!(w, "{}", sep)?; + curr_line_width += sep_width; + + if let Some(line_break) = &line_break { + if curr_line_width + sep_width + escaped_width > line_break.limit { + write!(w, "{}", line_break.sequence)?; + line_break_inserted = true; + curr_line_width = 0; + } } }