Skip to content

Commit 0f3b770

Browse files
committed
Revert changes to audit module.
1 parent 6c391f5 commit 0f3b770

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

crates/backend/src/audit.rs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,16 @@ pub type AuditProvider =
1010

1111
type AuditProviders = Vec<AuditProvider>;
1212

13-
static mut PROVIDERS: OnceLock<AuditProviders> = OnceLock::new();
13+
static PROVIDERS: OnceLock<AuditProviders> = OnceLock::new();
1414

1515
/// Initialize audit trail providers.
1616
pub fn init_providers(providers: AuditProviders) {
17-
unsafe {
18-
PROVIDERS.get_or_init(|| providers);
19-
}
20-
}
21-
22-
/// Update audit trail providers.
23-
///
24-
/// # Panics
25-
///
26-
/// If the audit trail providers have not already been set.
27-
pub fn update_providers(providers: AuditProviders) {
28-
unsafe {
29-
let audit_providers = PROVIDERS.get_mut().unwrap();
30-
*audit_providers = providers;
31-
}
17+
PROVIDERS.get_or_init(|| providers);
3218
}
3319

3420
/// Configured audit providers.
3521
pub fn providers<'a>() -> Option<&'a AuditProviders> {
36-
unsafe { PROVIDERS.get() }
22+
PROVIDERS.get()
3723
}
3824

3925
/// Append audit events to all configured providers.

crates/backend/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![deny(missing_docs)]
2+
#![forbid(unsafe_code)]
23
#![cfg_attr(all(doc, CHANNEL_NIGHTLY), feature(doc_auto_cfg))]
34
//! Backend database and file system storage.
45
mod access_point;

0 commit comments

Comments
 (0)