have Session::finish() use iter_join for better efficiency

This commit is contained in:
Edward Rudd 2022-09-26 12:20:28 -04:00
parent 580b972f45
commit 660e4b1668

View file

@ -216,14 +216,7 @@ impl<'a, T: Read + Write> AppendCmd<'a, T> {
/// Note: be sure to set flags and optional date before you /// Note: be sure to set flags and optional date before you
/// finish the command. /// finish the command.
pub fn finish(&mut self) -> Result<Appended> { pub fn finish(&mut self) -> Result<Appended> {
let flagstr = self let flagstr = iter_join(self.flags.iter().filter(|f| **f != Flag::Recent), " ");
.flags
.clone()
.into_iter()
.filter(|f| *f != Flag::Recent)
.map(|f| f.to_string())
.collect::<Vec<String>>()
.join(" ");
let datestr = if let Some(date) = self.date { let datestr = if let Some(date) = self.date {
format!(" \"{}\"", date.format("%d-%h-%Y %T %z")) format!(" \"{}\"", date.format("%d-%h-%Y %T %z"))