mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-05-14 12:18:35 -07:00
Fix clippy for Rust 1.95
This commit is contained in:
committed by
Brad Warren
parent
a1a29b5ec8
commit
ca30a146b2
@@ -289,19 +289,17 @@ impl DiagTask {
|
|||||||
self.stop(qmdl_store, Some(reason)).await;
|
self.stop(qmdl_store, Some(reason)).await;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DiskSpaceCheck::Warning(mb) => {
|
DiskSpaceCheck::Warning(mb) if !self.low_space_warned => {
|
||||||
if !self.low_space_warned {
|
self.low_space_warned = true;
|
||||||
self.low_space_warned = true;
|
warn!("Disk space low: {}MB remaining", mb);
|
||||||
warn!("Disk space low: {}MB remaining", mb);
|
self.notification_channel
|
||||||
self.notification_channel
|
.send(Notification::new(
|
||||||
.send(Notification::new(
|
NotificationType::Warning,
|
||||||
NotificationType::Warning,
|
format!("Disk space low: {}MB free", mb),
|
||||||
format!("Disk space low: {}MB free", mb),
|
Some(Duration::from_secs(30)),
|
||||||
Some(Duration::from_secs(30)),
|
))
|
||||||
))
|
.await
|
||||||
.await
|
.ok();
|
||||||
.ok();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ impl RecordingStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sort chronologically
|
// sort chronologically
|
||||||
manifest_entries.sort_by(|a, b| a.start_time.cmp(&b.start_time));
|
manifest_entries.sort_by_key(|a| a.start_time);
|
||||||
|
|
||||||
let mut store = RecordingStore {
|
let mut store = RecordingStore {
|
||||||
path: path.as_ref().to_path_buf(),
|
path: path.as_ref().to_path_buf(),
|
||||||
|
|||||||
@@ -81,11 +81,12 @@ impl DiskStats {
|
|||||||
let free_kb = (stat.f_bfree as u64 * block_size / 1024) as usize;
|
let free_kb = (stat.f_bfree as u64 * block_size / 1024) as usize;
|
||||||
let available_kb = (stat.f_bavail as u64 * block_size / 1024) as usize;
|
let available_kb = (stat.f_bavail as u64 * block_size / 1024) as usize;
|
||||||
let used_kb = total_kb.saturating_sub(free_kb);
|
let used_kb = total_kb.saturating_sub(free_kb);
|
||||||
let used_percent = if stat.f_blocks > 0 {
|
let used_percent = format!(
|
||||||
format!("{}%", (stat.f_blocks - stat.f_bfree) * 100 / stat.f_blocks)
|
"{}%",
|
||||||
} else {
|
((stat.f_blocks - stat.f_bfree) * 100)
|
||||||
"0%".to_string()
|
.checked_div(stat.f_blocks)
|
||||||
};
|
.unwrap_or(0)
|
||||||
|
);
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
partition: qmdl_path.to_string(),
|
partition: qmdl_path.to_string(),
|
||||||
|
|||||||
@@ -42,10 +42,7 @@ pub async fn telnet_send_command_with_output(
|
|||||||
|
|
||||||
let mut read_buf = Vec::new();
|
let mut read_buf = Vec::new();
|
||||||
timeout(Duration::from_secs(10), async {
|
timeout(Duration::from_secs(10), async {
|
||||||
loop {
|
while let Ok(byte) = reader.read_u8().await {
|
||||||
let Ok(byte) = reader.read_u8().await else {
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
read_buf.push(byte);
|
read_buf.push(byte);
|
||||||
|
|
||||||
// when we see this string we know the command is done and can terminate.
|
// when we see this string we know the command is done and can terminate.
|
||||||
|
|||||||
Reference in New Issue
Block a user