Skip to content

Commit

Permalink
Merge pull request #397 from nokyan/udeps
Browse files Browse the repository at this point in the history
Unnecessary depencencies, clippy, cosmetics
  • Loading branch information
nokyan authored Nov 8, 2024
2 parents 434f1a0 + 5153529 commit 868ac98
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 79 deletions.
11 changes: 2 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ clap = { version = "4.5.20", features = ["derive"] }
gettext-rs = { version = "0.7.2", features = ["gettext-system"] }
glob = "0.3.1"
gtk = { version = "0.9.3", features = ["v4_10"], package = "gtk4" }
gtk-macros = "0.3.0"
lazy-regex = "3.3.0"
libc = { version = "0.2.161", features = ["extra_traits"] }
libc = { version = "0.2.162", features = ["extra_traits"] }
log = "0.4.22"
nix = { version = "0.29.0", default-features = false, features = [
"signal",
Expand Down
77 changes: 41 additions & 36 deletions lib/process_data/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/process_data/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ opt-level = 3
anyhow = "1.0.93"
glob = "0.3.1"
lazy-regex = "3.3.0"
libc = "0.2.161"
libc = "0.2.162"
num_cpus = "1.16.0"
nutype = { version = "0.5.0", features = ["serde"] }
nvml-wrapper = "0.10.0"
Expand Down
7 changes: 4 additions & 3 deletions lib/process_data/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::os::linux::fs::MetadataExt;
use std::path::Path;
use std::str::FromStr;
use std::sync::{LazyLock, RwLock};
use std::{path::PathBuf, time::SystemTime};
use std::time::SystemTime;

const STAT_OFFSET: usize = 2; // we split the stat contents where the executable name ends, which is the second element
const STAT_PARENT_PID: usize = 3 - STAT_OFFSET;
Expand Down Expand Up @@ -236,7 +236,8 @@ impl ProcessData {
Ok(process_data)
}

pub fn try_from_path(proc_path: &PathBuf) -> Result<Self> {
pub fn try_from_path<P: AsRef<Path>>(proc_path: P) -> Result<Self> {
let proc_path = proc_path.as_ref();
let stat = std::fs::read_to_string(proc_path.join("stat"))?;
let statm = std::fs::read_to_string(proc_path.join("statm"))?;
let status = std::fs::read_to_string(proc_path.join("status"))?;
Expand Down Expand Up @@ -338,7 +339,7 @@ impl ProcessData {

let cgroup = std::fs::read_to_string(proc_path.join("cgroup"))
.ok()
.and_then(|raw| Self::sanitize_cgroup(raw));
.and_then(Self::sanitize_cgroup);

let containerization = if commandline.starts_with("/snap/") {
Containerization::Snap
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod application;
#[rustfmt::skip]
pub mod config;
pub mod gui;
pub mod i18n;
Expand Down
4 changes: 2 additions & 2 deletions src/ui/pages/gpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ impl ResGPU {
imp.temperature.graph().set_visible(temperature.is_some());

if let Some(temperature) = temperature {
let temperature_string = convert_temperature(*temperature as f64);
let temperature_string = convert_temperature(*temperature);

let highest_temperature_string =
convert_temperature(imp.temperature.graph().get_highest_value());
Expand All @@ -398,7 +398,7 @@ impl ResGPU {
i18n("Highest:"),
highest_temperature_string
));
imp.temperature.graph().push_data_point(*temperature as f64);
imp.temperature.graph().push_data_point(*temperature);

usage_percentage_string.push_str(" · ");
usage_percentage_string.push_str(&temperature_string);
Expand Down
4 changes: 2 additions & 2 deletions src/ui/pages/npu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ impl ResNPU {
}

if let Some(temperature) = temperature {
let temperature_string = convert_temperature(*temperature as f64);
let temperature_string = convert_temperature(*temperature);

let highest_temperature_string =
convert_temperature(imp.temperature.graph().get_highest_value());
Expand All @@ -321,7 +321,7 @@ impl ResNPU {
i18n("Highest:"),
highest_temperature_string
));
imp.temperature.graph().push_data_point(*temperature as f64);
imp.temperature.graph().push_data_point(*temperature);

usage_percentage_string.push_str(" · ");
usage_percentage_string.push_str(&temperature_string);
Expand Down
Loading

0 comments on commit 868ac98

Please sign in to comment.