style: Clippy-Hinweise in health.rs (#1197)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GmHhg7qE8FdhchzsBrwgjZ
This commit is contained in:
@ -186,23 +186,23 @@ pub fn bewerte(e: &Eingabe) -> Gesundheit {
|
||||
}
|
||||
|
||||
if let Some(h) = &e.host {
|
||||
if let Some(ram) = h.ram {
|
||||
if let Some(s) = anteil(ram.belegt_mb, ram.gesamt_mb).and_then(stufe) {
|
||||
gruende.push(grund(
|
||||
s,
|
||||
"Arbeitsspeicher",
|
||||
format!("Über {} Prozent belegt", schwelle(s)),
|
||||
));
|
||||
}
|
||||
if let Some(s) = h
|
||||
.ram
|
||||
.and_then(|ram| anteil(ram.belegt_mb, ram.gesamt_mb))
|
||||
.and_then(stufe)
|
||||
{
|
||||
gruende.push(grund(
|
||||
s,
|
||||
"Arbeitsspeicher",
|
||||
format!("Über {} Prozent belegt", schwelle(s)),
|
||||
));
|
||||
}
|
||||
if let Some(cpu) = h.cpu_prozent {
|
||||
if cpu >= KNAPP_PROZENT {
|
||||
gruende.push(grund(
|
||||
Schwere::Eingeschraenkt,
|
||||
"CPU",
|
||||
format!("Auslastung über {} Prozent", KNAPP_PROZENT as u32),
|
||||
));
|
||||
}
|
||||
if h.cpu_prozent.is_some_and(|cpu| cpu >= KNAPP_PROZENT) {
|
||||
gruende.push(grund(
|
||||
Schwere::Eingeschraenkt,
|
||||
"CPU",
|
||||
format!("Auslastung über {} Prozent", KNAPP_PROZENT as u32),
|
||||
));
|
||||
}
|
||||
if let Some(f) = &h.fehler {
|
||||
gruende.push(grund(
|
||||
@ -223,14 +223,12 @@ pub fn bewerte(e: &Eingabe) -> Gesundheit {
|
||||
),
|
||||
));
|
||||
}
|
||||
if let Some(w) = e.aelteste_wartezeit_s {
|
||||
if w >= WARTEZEIT_WARNUNG_S {
|
||||
gruende.push(grund(
|
||||
Schwere::Eingeschraenkt,
|
||||
"Warteschlange",
|
||||
format!("Älteste Anfrage wartet seit {w} Sekunden"),
|
||||
));
|
||||
}
|
||||
if let Some(w) = e.aelteste_wartezeit_s.filter(|w| *w >= WARTEZEIT_WARNUNG_S) {
|
||||
gruende.push(grund(
|
||||
Schwere::Eingeschraenkt,
|
||||
"Warteschlange",
|
||||
format!("Älteste Anfrage wartet seit {w} Sekunden"),
|
||||
));
|
||||
}
|
||||
|
||||
// Veraltete Messwerte werden nie als „in Ordnung“ gewertet.
|
||||
@ -247,7 +245,7 @@ pub fn bewerte(e: &Eingabe) -> Gesundheit {
|
||||
}
|
||||
}
|
||||
|
||||
gruende.sort_by(|a, b| b.schwere.cmp(&a.schwere));
|
||||
gruende.sort_by_key(|g| std::cmp::Reverse(g.schwere));
|
||||
let schwerste = gruende.first().map(|g| g.schwere);
|
||||
let noch_nichts_gemessen = e.gpu_alter_s.is_none() && e.host_alter_s.is_none();
|
||||
let zustand = match schwerste {
|
||||
|
||||
Reference in New Issue
Block a user