From e2f781c7ead3a9fe69020189decc6c3eebf6f25c Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Wed, 10 May 2017 13:19:29 +0200 Subject: Example usage of multiple suggestions --- src/librustc_errors/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/librustc_errors/lib.rs') diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 8e378935094..82d688d6ba6 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -183,7 +183,10 @@ impl CodeSuggestion { prev_line = fm.get_line(prev_hi.line - 1); } for buf in &mut bufs { - push_trailing(buf, prev_line, &prev_hi, None); + // if the replacement already ends with a newline, don't print the next line + if !buf.ends_with('\n') { + push_trailing(buf, prev_line, &prev_hi, None); + } // remove trailing newline buf.pop(); } -- cgit 1.4.1-3-g733a5