Skip to content
Myr

Remove trimming from Indented writer

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Starting error messages with "\n " so that rustc's default `main` prints them on the next line after the "Error:" heading is not a pattern I want to encourage.

authored by David Tolnay · committed by David Tolnay · parent b0892e8 · Browse files · 1 file+1 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−8 removed

  • other:+1 added−8 removed

1 file+1 added−8 removed

modified:src/fmt.rs+1 added-8 removed
67 unmodified lines
68where69 T: Write,70{71 fn write_str(&mut self, s: &str) -> fmt::Result {72 for (ind, mut line) in s.split('\n').enumerate() {72 for (ind, line) in s.split('\n').enumerate() {73 if !self.started {74 // trim first line to ensure it lines up with the number nicely75 line = line.trim();76 // Don't render the first line unless its actually got text on it77 if line.is_empty() {78 continue;79 }8074 self.started = true;75 match self.ind {76 Some(ind) => self.inner.write_fmt(format_args!("{: >5}: ", ind))?,77 None => self.inner.write_fmt(format_args!(" "))?,
72 unmodified lines