From 66dc8cb5d356c6e32be35de127dbbba07235c2a4 Mon Sep 17 00:00:00 2001 From: Matt Harding Date: Wed, 20 Dec 2023 19:54:42 +0000 Subject: [PATCH] Make settings file allow multiple borrows --- src/settings.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/settings.rs b/src/settings.rs index 02e445278e1..59fd8461e91 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -38,9 +38,10 @@ impl SettingsFile { fn read_settings(&self) -> Result<()> { let mut needs_save = false; { - let mut b = self.cache.borrow_mut(); + let b = self.cache.borrow(); if b.is_none() { - *b = Some(if utils::is_file(&self.path) { + drop(b); + *self.cache.borrow_mut() = Some(if utils::is_file(&self.path) { let content = utils::read_file("settings", &self.path)?; Settings::parse(&content)? } else {