Remove unnecessary mut and document possible panic
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Valentin Brandl 2023-08-27 14:34:14 +02:00
parent bfa9ac5621
commit c0648c2b3c
Signed by: vbrandl
GPG Key ID: CAD4DA1A789125F9
2 changed files with 5 additions and 1 deletions

View File

@ -74,7 +74,7 @@ impl<'a> CacheState<'a> {
trace!("Calculating new cache"); trace!("Calculating new cache");
match self { match self {
CacheState::Old { mut cache, .. } => { CacheState::Old { mut cache, .. } => {
if let Some(mut cache) = cache.entries.get_mut(branch) { if let Some(cache) = cache.entries.get_mut(branch) {
cache.head = head; cache.head = head;
cache.count += count; cache.count += count;
cache.commits += commits; cache.commits += commits;

View File

@ -15,6 +15,10 @@ pub fn get_subscriber(name: &str, env_filter: &str) -> impl Subscriber + Send +
.with(formatting_layer) .with(formatting_layer)
} }
/// # Panics
///
/// This panics if the `LogTracer` cannot be initialized or `subscriber` cannot be set as global
/// default.
pub fn init_subscriber(subscriber: impl Subscriber + Send + Sync) { pub fn init_subscriber(subscriber: impl Subscriber + Send + Sync) {
LogTracer::init().expect("Failed to set logger"); LogTracer::init().expect("Failed to set logger");
set_global_default(subscriber).expect("Failed to set tracing subscriber"); set_global_default(subscriber).expect("Failed to set tracing subscriber");