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
+10 -5
View File
@@ -74,7 +74,8 @@ pub fn set_config_name(name: impl Into<String>) {
pub fn get_config_name() -> String { pub fn get_config_name() -> String {
if let Some(lock) = CONFIG_NAME.get() if let Some(lock) = CONFIG_NAME.get()
&& let Ok(guard) = lock.read() && let Ok(guard) = lock.read()
&& let Some(name) = guard.as_ref() { && let Some(name) = guard.as_ref()
{
return name.clone(); return name.clone();
} }
DEFAULT_CONFIG_NAME.to_string() DEFAULT_CONFIG_NAME.to_string()
@@ -99,7 +100,8 @@ pub fn clear_custom_dir() {
/// Liefert das aktuell gesetzte benutzerdefinierte Konfigurationsverzeichnis, falls vorhanden. /// Liefert das aktuell gesetzte benutzerdefinierte Konfigurationsverzeichnis, falls vorhanden.
pub fn get_custom_dir() -> Option<PathBuf> { pub fn get_custom_dir() -> Option<PathBuf> {
if let Some(lock) = CUSTOM_CONFIG_DIR.get() if let Some(lock) = CUSTOM_CONFIG_DIR.get()
&& let Ok(guard) = lock.read() { && let Ok(guard) = lock.read()
{
return guard.clone(); return guard.clone();
} }
None None
@@ -124,7 +126,8 @@ pub fn clear_custom_path() {
/// Liefert den aktuell gesetzten expliziten Pfad zur Konfigurationsdatei, falls vorhanden. /// Liefert den aktuell gesetzten expliziten Pfad zur Konfigurationsdatei, falls vorhanden.
pub fn get_custom_path() -> Option<PathBuf> { pub fn get_custom_path() -> Option<PathBuf> {
if let Some(lock) = CUSTOM_CONFIG_PATH.get() if let Some(lock) = CUSTOM_CONFIG_PATH.get()
&& let Ok(guard) = lock.read() { && let Ok(guard) = lock.read()
{
return guard.clone(); return guard.clone();
} }
None None
@@ -261,13 +264,15 @@ where
if let Ok(guard) = map_lock.read() if let Ok(guard) = map_lock.read()
&& let Some(entry) = guard.get(&TypeId::of::<T>()) && let Some(entry) = guard.get(&TypeId::of::<T>())
&& let Some(val) = entry.downcast_ref::<T>() { && let Some(val) = entry.downcast_ref::<T>()
{
return val; return val;
} }
let mut guard = map_lock.write().unwrap(); let mut guard = map_lock.write().unwrap();
if let Some(entry) = guard.get(&TypeId::of::<T>()) if let Some(entry) = guard.get(&TypeId::of::<T>())
&& let Some(val) = entry.downcast_ref::<T>() { && let Some(val) = entry.downcast_ref::<T>()
{
return val; return val;
} }
+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()) TEST_LOCK.lock().unwrap_or_else(|e| e.into_inner())
} }
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Default)]
#[derive(Default)]
struct DummyAppConfig { struct DummyAppConfig {
general: DummyGeneral, general: DummyGeneral,
} }
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] #[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
struct DummyGeneral { struct DummyGeneral {
log_level: String, log_level: String,