about summary refs log tree commit diff
path: root/src/librustc_errors/lib.rs
diff options
context:
space:
mode:
authorOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>2017-05-10 13:19:29 +0200
committerOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>2017-05-10 13:20:27 +0200
commite2f781c7ead3a9fe69020189decc6c3eebf6f25c (patch)
tree8a94ecdac7c2981d39e111f756541bfc4d51787a /src/librustc_errors/lib.rs
parent67d762d896c8748009d1843ebf9e2e0760ed33a0 (diff)
downloadrust-e2f781c7ead3a9fe69020189decc6c3eebf6f25c.tar.gz
rust-e2f781c7ead3a9fe69020189decc6c3eebf6f25c.zip
Example usage of multiple suggestions
Diffstat (limited to 'src/librustc_errors/lib.rs')
-rw-r--r--src/librustc_errors/lib.rs5
1 files changed, 4 insertions, 1 deletions
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();
         }