Skip to content

Commit

Permalink
Don't break first line
Browse files Browse the repository at this point in the history
  • Loading branch information
ecstatic-morse committed Feb 9, 2020
1 parent fb14386 commit 83dfb42
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/librustc_mir/dataflow/generic/graphviz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -610,25 +610,25 @@ 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 =
str::from_utf8(&buf).expect("Output of `pretty_print_idx` must be valid UTF-8");
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;
}
}
}

Expand Down

0 comments on commit 83dfb42

Please sign in to comment.