Skip to content

Commit 2c0f86a

Browse files
majaharami3l
authored andcommitted
Make settings file allow multiple borrows
1 parent 5d8512e commit 2c0f86a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/settings.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ impl SettingsFile {
3838
fn read_settings(&self) -> Result<()> {
3939
let mut needs_save = false;
4040
{
41-
let mut b = self.cache.borrow_mut();
41+
let b = self.cache.borrow();
4242
if b.is_none() {
43-
*b = Some(if utils::is_file(&self.path) {
43+
drop(b);
44+
*self.cache.borrow_mut() = Some(if utils::is_file(&self.path) {
4445
let content = utils::read_file("settings", &self.path)?;
4546
Settings::parse(&content)?
4647
} else {

0 commit comments

Comments
 (0)