mirror of
https://github.com/NotAShelf/microfetch.git
synced 2024-11-26 08:46:45 +00:00
apply clippy lints
This commit is contained in:
parent
aae5f71004
commit
42a7f2fc77
5 changed files with 16 additions and 19 deletions
|
@ -9,5 +9,5 @@ pub fn get_desktop_info() -> Result<String, io::Error> {
|
|||
// instead of just "foo"
|
||||
let desktop_env = desktop_env.trim_start_matches("none+");
|
||||
|
||||
Ok(format!("{} ({})", desktop_env, display_backend))
|
||||
Ok(format!("{desktop_env} ({display_backend})"))
|
||||
}
|
||||
|
|
17
src/main.rs
17
src/main.rs
|
@ -27,15 +27,14 @@ fn main() -> Result<(), Report> {
|
|||
|
||||
println!(
|
||||
"
|
||||
{CYAN} ▗▄ {BLUE}▗▄ ▄▖ {} ~{RESET}
|
||||
{CYAN} ▄▄🬸█▄▄▄{BLUE}🬸█▛ {CYAN}▃ {CYAN} {BLUE}System{RESET} {}
|
||||
{BLUE} ▟▛ ▜{CYAN}▃▟🬕 {CYAN} {BLUE}Kernel{RESET} {}
|
||||
{BLUE}🬋🬋🬫█ {CYAN}█🬛🬋🬋 {CYAN} {BLUE}Uptime{RESET} {}
|
||||
{BLUE} 🬷▛🮃{CYAN}▙ ▟▛ {CYAN} {BLUE}WM{RESET} {}
|
||||
{BLUE} 🮃 {CYAN}▟█🬴{BLUE}▀▀▀█🬴▀▀ {CYAN} {BLUE}Memory{RESET} {}
|
||||
{CYAN} ▝▀ ▀▘ {BLUE}▀▘ {CYAN} {BLUE}Storage (/){RESET} {}
|
||||
",
|
||||
user_info, os_name, kernel_version, uptime, window_manager, memory_usage, storage
|
||||
{CYAN} ▗▄ {BLUE}▗▄ ▄▖ {user_info} ~{RESET}
|
||||
{CYAN} ▄▄🬸█▄▄▄{BLUE}🬸█▛ {CYAN}▃ {CYAN} {BLUE}System{RESET} {os_name}
|
||||
{BLUE} ▟▛ ▜{CYAN}▃▟🬕 {CYAN} {BLUE}Kernel{RESET} {kernel_version}
|
||||
{BLUE}🬋🬋🬫█ {CYAN}█🬛🬋🬋 {CYAN} {BLUE}Uptime{RESET} {uptime}
|
||||
{BLUE} 🬷▛🮃{CYAN}▙ ▟▛ {CYAN} {BLUE}WM{RESET} {window_manager}
|
||||
{BLUE} 🮃 {CYAN}▟█🬴{BLUE}▀▀▀█🬴▀▀ {CYAN} {BLUE}Memory{RESET} {memory_usage}
|
||||
{CYAN} ▝▀ ▀▘ {BLUE}▀▘ {CYAN} {BLUE}Storage (/){RESET} {storage}
|
||||
"
|
||||
);
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -34,7 +34,7 @@ pub fn get_system_info() -> Result<String, io::Error> {
|
|||
|
||||
let architecture = get_architecture()?;
|
||||
|
||||
let result = format!("{} {} ({})", system, kernel_release, architecture);
|
||||
let result = format!("{system} {kernel_release} ({architecture})");
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ pub fn get_username_and_hostname() -> Result<String, io::Error> {
|
|||
let output = Command::new("hostname").output()?;
|
||||
let hostname = String::from_utf8_lossy(&output.stdout).trim().to_string();
|
||||
|
||||
Ok(format!("{YELLOW}{}{RED}@{GREEN}{}", username, hostname))
|
||||
Ok(format!("{YELLOW}{username}{RED}@{GREEN}{hostname}"))
|
||||
}
|
||||
|
||||
pub fn get_root_disk_usage() -> Result<String, Box<dyn std::error::Error>> {
|
||||
|
@ -30,8 +30,7 @@ pub fn get_root_disk_usage() -> Result<String, Box<dyn std::error::Error>> {
|
|||
let usage_percentage = (used_size as f64 / total_size as f64) * 100.0;
|
||||
|
||||
Ok(format!(
|
||||
"{:.2} GiB / {:.2} GiB ({CYAN}{:.0}%{RESET})",
|
||||
used_size_gib, total_size_gib, usage_percentage
|
||||
"{used_size_gib:.2} GiB / {total_size_gib:.2} GiB ({CYAN}{usage_percentage:.0}%{RESET})"
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -78,7 +77,6 @@ pub fn get_memory_usage() -> Result<String, io::Error> {
|
|||
let percentage_used = (used_memory / total_memory * 100.0).round() as u64;
|
||||
|
||||
Ok(format!(
|
||||
"{:.2} GiB / {:.2} GiB ({CYAN}{}%{RESET})",
|
||||
used_memory, total_memory, percentage_used
|
||||
"{used_memory:.2} GiB / {total_memory:.2} GiB ({CYAN}{percentage_used}%{RESET})"
|
||||
))
|
||||
}
|
||||
|
|
|
@ -27,15 +27,15 @@ pub fn get_system_uptime() -> Result<String, io::Error> {
|
|||
|
||||
let mut parts = Vec::new();
|
||||
if days > 0 {
|
||||
parts.push(format!("{} days", days));
|
||||
parts.push(format!("{days} days"));
|
||||
}
|
||||
|
||||
if hours > 0 || days > 0 {
|
||||
parts.push(format!("{} hours", hours));
|
||||
parts.push(format!("{hours} hours"));
|
||||
}
|
||||
|
||||
if minutes > 0 || hours > 0 || days > 0 {
|
||||
parts.push(format!("{} minutes", minutes));
|
||||
parts.push(format!("{minutes} minutes"));
|
||||
}
|
||||
|
||||
Ok(parts.join(", "))
|
||||
|
|
Loading…
Reference in a new issue