diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-10-28 09:39:10 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-10-28 09:39:10 +0300 |
commit | dd93ccc69481216cbf09a1ca07670ecc8990e577 (patch) | |
tree | 9d884ad4ee6a16723088fa1ea3f3c250ab3d2263 | |
parent | 2f5d78cd7c15e118cc5cf15930cbb0635255aec4 (diff) | |
download | clab-dd93ccc69481216cbf09a1ca07670ecc8990e577.tar.gz |
fix: write the sorted entries in reformat
Sponsored-by: author
-rw-r--r-- | src/main.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 982cc52..ec62374 100644 --- a/src/main.rs +++ b/src/main.rs @@ -258,7 +258,7 @@ impl Reformat { let mut entries: Vec<Entry> = book.entries().to_vec(); entries.sort_by_cached_key(|e| e.name.clone()); if self.stdout { - serde_yaml::to_writer(std::io::stdout(), book.entries())?; + serde_yaml::to_writer(std::io::stdout(), &entries)?; } else { let filename = book.filename(); let dirname = match filename.parent() { @@ -267,7 +267,7 @@ impl Reformat { Some(x) => x, }; let temp = NamedTempFile::new_in(dirname)?; - serde_yaml::to_writer(&temp, book.entries())?; + serde_yaml::to_writer(&temp, &entries)?; std::fs::rename(temp.path(), filename)?; } Ok(()) |