src/backup/manifest.rs: cleanup - again, avoid recursive call to write_canonical_json

And use re-borrow instead of dyn trait casting.
This commit is contained in:
Dietmar Maurer 2020-07-27 10:31:34 +02:00
parent 0bf7ba6c92
commit bccdc5fa04
1 changed files with 2 additions and 2 deletions

View File

@ -160,12 +160,12 @@ impl BackupManifest {
keys.sort();
let mut iter = keys.into_iter();
if let Some(key) = iter.next() {
serde_json::to_writer(output as &mut dyn std::io::Write, &key)?;
serde_json::to_writer(&mut *output, &key)?;
output.push(b':');
Self::write_canonical_json(&map[key], output)?;
for key in iter {
output.push(b',');
Self::write_canonical_json(&key.into(), output)?;
serde_json::to_writer(&mut *output, &key)?;
output.push(b':');
Self::write_canonical_json(&map[key], output)?;
}