From ed271cf2a237fff5e3cf3ac7934873a2040f9d8e Mon Sep 17 00:00:00 2001 From: Wojciech Kozlowski Date: Sat, 9 Mar 2024 20:49:24 +0100 Subject: [PATCH] Simplify --- src/core/musichoard/musichoard.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/musichoard/musichoard.rs b/src/core/musichoard/musichoard.rs index 6d11e15..191722c 100644 --- a/src/core/musichoard/musichoard.rs +++ b/src/core/musichoard/musichoard.rs @@ -207,8 +207,7 @@ impl MusicHoard { /// Rescan the library and merge with the in-memory collection. pub fn rescan_library(&mut self) -> Result<(), Error> { self.pre_commit = self.rescan_library_inner()?; - self.collection = self.pre_commit.clone(); - Ok(()) + self.commit() } } @@ -238,6 +237,13 @@ impl MusicHoard { } } +impl MusicHoard { + fn commit(&mut self) -> Result<(), Error> { + self.collection = self.pre_commit.clone(); + Ok(()) + } +} + impl MusicHoard { /// Load the database and merge with the in-memory collection. pub fn reload_database(&mut self) -> Result<(), Error> {