Skip to content

Commit feefcf9

Browse files
committed
1 parent 7c75b77 commit feefcf9

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

qlty-cloud/src/auth/credentials.rs

+12-11
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,17 @@ pub fn set_mock_entry(entry: Arc<Entry>) {
3232

3333
fn entry() -> Result<Arc<Entry>> {
3434
let mut guard = ENTRY.lock().unwrap();
35-
if let Some(entry) = &*guard {
36-
return Ok(entry.clone());
35+
match &*guard {
36+
Some(entry) => Ok(entry.clone()),
37+
None => {
38+
let entry = Arc::new(Entry::new(SERVICE, DEFAULT_USER).with_context(|| {
39+
format!(
40+
"Failed to create keyring entry for service '{}' and user '{}'",
41+
SERVICE, DEFAULT_USER
42+
)
43+
})?);
44+
guard.replace(entry.clone());
45+
Ok(entry)
46+
}
3747
}
38-
39-
let entry = Arc::new(Entry::new(SERVICE, DEFAULT_USER).with_context(|| {
40-
format!(
41-
"Failed to create keyring entry for service '{}' and user '{}'",
42-
SERVICE, DEFAULT_USER
43-
)
44-
})?);
45-
guard.replace(entry.clone());
46-
Ok(entry)
4748
}

0 commit comments

Comments
 (0)