1
Fork 0

match on chars instead of &strs for .split() or .strip_prefix()

This commit is contained in:
Matthias Krüger 2023-07-23 10:12:40 +02:00
parent cec34a43b1
commit 7a7708904b
5 changed files with 7 additions and 7 deletions

View file

@ -15,11 +15,11 @@ struct Indentor<'a, 'b> {
impl Write for Indentor<'_, '_> {
fn write_str(&mut self, s: &str) -> std::fmt::Result {
for line in s.split_inclusive("\n") {
for line in s.split_inclusive('\n') {
if self.on_newline {
self.f.write_str(" ")?;
}
self.on_newline = line.ends_with("\n");
self.on_newline = line.ends_with('\n');
self.f.write_str(line)?;
}