Style: Automatische Formatierung & Clippy-Fixes
TruffleHog Secret Scan / TruffleHog (push) Successful in 16s
Security Scans / Trivy & OSV-Scanner (push) Successful in 26s
Code Quality (Auto-Format & Clippy-Fix) / Formatierung & Clippy automatisch beheben (push) Successful in 28s
TruffleHog Secret Scan / TruffleHog (pull_request) Successful in 16s
Security Scans / Trivy & OSV-Scanner (pull_request) Successful in 32s
Unit-Tests / Unit-Tests (pull_request) Successful in 55s

This commit is contained in:
2026-09-12 22:33:04 +00:00
parent 29e41e8ea2
commit 6a48840ec0
2 changed files with 21 additions and 18 deletions
+20 -15
View File
@@ -74,9 +74,10 @@ pub fn set_config_name(name: impl Into<String>) {
pub fn get_config_name() -> String {
if let Some(lock) = CONFIG_NAME.get()
&& let Ok(guard) = lock.read()
&& let Some(name) = guard.as_ref() {
return name.clone();
}
&& let Some(name) = guard.as_ref()
{
return name.clone();
}
DEFAULT_CONFIG_NAME.to_string()
}
@@ -99,9 +100,10 @@ pub fn clear_custom_dir() {
/// Liefert das aktuell gesetzte benutzerdefinierte Konfigurationsverzeichnis, falls vorhanden.
pub fn get_custom_dir() -> Option<PathBuf> {
if let Some(lock) = CUSTOM_CONFIG_DIR.get()
&& let Ok(guard) = lock.read() {
return guard.clone();
}
&& let Ok(guard) = lock.read()
{
return guard.clone();
}
None
}
@@ -124,9 +126,10 @@ pub fn clear_custom_path() {
/// Liefert den aktuell gesetzten expliziten Pfad zur Konfigurationsdatei, falls vorhanden.
pub fn get_custom_path() -> Option<PathBuf> {
if let Some(lock) = CUSTOM_CONFIG_PATH.get()
&& let Ok(guard) = lock.read() {
return guard.clone();
}
&& let Ok(guard) = lock.read()
{
return guard.clone();
}
None
}
@@ -261,15 +264,17 @@ where
if let Ok(guard) = map_lock.read()
&& let Some(entry) = guard.get(&TypeId::of::<T>())
&& let Some(val) = entry.downcast_ref::<T>() {
return val;
}
&& let Some(val) = entry.downcast_ref::<T>()
{
return val;
}
let mut guard = map_lock.write().unwrap();
if let Some(entry) = guard.get(&TypeId::of::<T>())
&& let Some(val) = entry.downcast_ref::<T>() {
return val;
}
&& let Some(val) = entry.downcast_ref::<T>()
{
return val;
}
let loaded: T = load_config::<T>();
let boxed: &'static T = Box::leak(Box::new(loaded));
+1 -3
View File
@@ -16,13 +16,11 @@ fn lock_test() -> std::sync::MutexGuard<'static, ()> {
TEST_LOCK.lock().unwrap_or_else(|e| e.into_inner())
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[derive(Default)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Default)]
struct DummyAppConfig {
general: DummyGeneral,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
struct DummyGeneral {
log_level: String,