itertools icon indicating copy to clipboard operation
itertools copied to clipboard

FormatWith should use a Cell

Open Ten0 opened this issue 2 years ago • 0 comments

The RefCell is unnecessary, as all we're doing is .take(), which is also available on Cell: https://doc.rust-lang.org/stable/std/cell/struct.Cell.html#method.take

https://github.com/rust-itertools/itertools/blob/943494c2be3977a42df701dfde90d903ae17d16d/src/format.rs#L14

This results in using more memory and generating more code than necessary.

Ten0 avatar Mar 15 '22 18:03 Ten0