aboutsummaryrefslogtreecommitdiff
path: root/crates/whirl_api/src/routes/stats
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-28 00:06:40 +0000
committerFuwn <[email protected]>2021-05-28 00:06:40 +0000
commitd87b4825480f938cfa552421e220d8f85a1bee10 (patch)
treed9c69c0dc4f5a9e876460d10e101d936f424bee5 /crates/whirl_api/src/routes/stats
parentMerge branch 'develop' of https://github.com/Whirlsplash/whirl into develop (diff)
downloadwhirl-d87b4825480f938cfa552421e220d8f85a1bee10.tar.xz
whirl-d87b4825480f938cfa552421e220d8f85a1bee10.zip
fix(global): a lot of clippy warnings
This change makes clippy **a lot** more strict.
Diffstat (limited to 'crates/whirl_api/src/routes/stats')
-rw-r--r--crates/whirl_api/src/routes/stats/mod.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/whirl_api/src/routes/stats/mod.rs b/crates/whirl_api/src/routes/stats/mod.rs
index 5a41630..02c3d22 100644
--- a/crates/whirl_api/src/routes/stats/mod.rs
+++ b/crates/whirl_api/src/routes/stats/mod.rs
@@ -3,7 +3,10 @@
pub mod structures;
+use std::convert::TryFrom;
+
use actix_web::HttpResponse;
+use num_traits::cast::AsPrimitive;
use sysinfo::{get_current_pid, ProcessExt, System, SystemExt};
use crate::routes::stats::structures::{Statistics, StatisticsProcess, StatisticsSystem};
@@ -20,14 +23,14 @@ pub fn statistics() -> HttpResponse {
system: StatisticsSystem {
os_type: sys.get_name().unwrap(),
release: sys.get_kernel_version().unwrap(),
- uptime: whirl_common::system::seconds_to_hrtime(
- sysinfo::System::new().get_uptime() as usize
+ uptime: whirl_common::system::seconds_to_hrtime(
+ usize::try_from(sysinfo::System::new().get_uptime()).unwrap(),
),
},
process: StatisticsProcess {
// (process.cpu_usage() * 100.0).round() / 100.0
memory_usage: (process.memory() / 1000).to_string(),
- cpu_usage: (process.cpu_usage() / sys.get_processors().len() as f32).to_string(),
+ cpu_usage: (process.cpu_usage() / sys.get_processors().len().as_(): f32).to_string(),
// uptime: seconds_to_hrtime((sys.get_uptime() - process.start_time()) as usize),
},
})