Skip to content

Commit ad3340a

Browse files
committed
FIX: Small de-bloat change in arrayformat
Use for loop instead of .try_for_each; the latter produces a lot more code (unoptimized) and is unnecessary in this instance.
1 parent 277e49b commit ad3340a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/arrayformat.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -90,23 +90,23 @@ fn format_with_overflow(
9090
// no-op
9191
} else if length <= limit {
9292
fmt_elem(f, 0)?;
93-
(1..length).try_for_each(|i| {
93+
for i in 1..length {
9494
f.write_str(separator)?;
95-
fmt_elem(f, i)
96-
})?;
95+
fmt_elem(f, i)?
96+
}
9797
} else {
9898
let edge = limit / 2;
9999
fmt_elem(f, 0)?;
100-
(1..edge).try_for_each(|i| {
100+
for i in 1..edge {
101101
f.write_str(separator)?;
102-
fmt_elem(f, i)
103-
})?;
102+
fmt_elem(f, i)?;
103+
}
104104
f.write_str(separator)?;
105105
f.write_str(ellipsis)?;
106-
(length - edge..length).try_for_each(|i| {
106+
for i in length - edge..length {
107107
f.write_str(separator)?;
108-
fmt_elem(f, i)
109-
})?;
108+
fmt_elem(f, i)?
109+
}
110110
}
111111
Ok(())
112112
}

0 commit comments

Comments
 (0)