Skip to content
Myr

Simplify string writing in Indented

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

authored by David Tolnay · committed by David Tolnay · parent 88a72fa · Browse files · 1 file+5 added−5 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+5 added−5 removed

  • other:+5 added−5 removed

1 file+5 added−5 removed

modified:src/fmt.rs+5 added-5 removed
71 unmodified lines
72 for (ind, line) in s.split('\n').enumerate() {73 if !self.started {74 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!(" "))?,76 Some(ind) => write!(self.inner, "{: >5}: ", ind)?,77 None => self.inner.write_str(" ")?,78 }79 } else if ind > 0 {80 self.inner.write_char('\n')?;81 if self.ind.is_some() {82 self.inner.write_fmt(format_args!(" "))?;82 self.inner.write_str(" ")?;83 } else {84 self.inner.write_fmt(format_args!(" "))?;84 self.inner.write_str(" ")?;85 }86 }8788 self.inner.write_fmt(format_args!("{}", line))?;88 self.inner.write_str(line)?;89 }9091 Ok(())92 }
57 unmodified lines