mirror of
https://github.com/NotAShelf/microfetch.git
synced 2024-11-22 23:40:42 +00:00
clippy lints
This commit is contained in:
parent
0e4b2d2ac1
commit
cff4332122
4 changed files with 7 additions and 20 deletions
|
@ -22,5 +22,5 @@ pub fn get_desktop_info() -> Result<String, io::Error> {
|
|||
&display_backend
|
||||
};
|
||||
|
||||
Ok(format!("{} ({})", desktop_env, display_backend))
|
||||
Ok(format!("{desktop_env} ({display_backend})"))
|
||||
}
|
||||
|
|
16
src/main.rs
16
src/main.rs
|
@ -10,7 +10,7 @@ use crate::colors::{BLUE, CYAN, RESET};
|
|||
use crate::desktop::get_desktop_info;
|
||||
use crate::release::{get_os_pretty_name, get_system_info};
|
||||
use crate::system::{get_memory_usage, get_root_disk_usage, get_username_and_hostname};
|
||||
use crate::uptime::get_system_uptime;
|
||||
use crate::uptime::get_current;
|
||||
|
||||
fn main() -> Result<(), Report> {
|
||||
color_eyre::install()?;
|
||||
|
@ -18,7 +18,7 @@ fn main() -> Result<(), Report> {
|
|||
let user_info = get_username_and_hostname()?;
|
||||
let os_name = get_os_pretty_name()?;
|
||||
let kernel_version = get_system_info()?;
|
||||
let uptime = get_system_uptime()?;
|
||||
let uptime = get_current()?;
|
||||
let window_manager = get_desktop_info()?;
|
||||
let memory_usage = get_memory_usage()?;
|
||||
let storage = get_root_disk_usage()?;
|
||||
|
@ -54,16 +54,6 @@ fn print_system_info(
|
|||
{BLUE} 🬷▛🮃{CYAN}▙ ▟▛ {CYAN} {BLUE}WM{RESET} {window_manager}
|
||||
{BLUE} 🮃 {CYAN}▟█🬴{BLUE}▀▀▀█🬴▀▀ {CYAN} {BLUE}Memory{RESET} {memory_usage}
|
||||
{CYAN} ▝▀ ▀▘ {BLUE}▀▘ {CYAN} {BLUE}Storage (/){RESET} {storage}
|
||||
",
|
||||
CYAN = CYAN,
|
||||
BLUE = BLUE,
|
||||
RESET = RESET,
|
||||
user_info = user_info,
|
||||
os_name = os_name,
|
||||
kernel_version = kernel_version,
|
||||
uptime = uptime,
|
||||
window_manager = window_manager,
|
||||
memory_usage = memory_usage,
|
||||
storage = storage
|
||||
"
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use color_eyre::{Result};
|
||||
use color_eyre::Result;
|
||||
use std::fs::{self, read_to_string};
|
||||
use std::io::{self, Read};
|
||||
|
||||
|
@ -49,8 +49,5 @@ pub fn get_os_pretty_name() -> Result<String, io::Error> {
|
|||
.to_string()
|
||||
});
|
||||
|
||||
match pretty_name {
|
||||
Some(name) => Ok(name),
|
||||
None => Ok("Unknown".to_string()),
|
||||
}
|
||||
Ok(pretty_name.unwrap_or_else(|| "Unknown".to_string()))
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::fs::File;
|
|||
use std::io::{self, BufRead};
|
||||
use std::path::Path;
|
||||
|
||||
pub fn get_system_uptime() -> Result<String, io::Error> {
|
||||
pub fn get_current() -> Result<String, io::Error> {
|
||||
let path = Path::new("/proc/uptime");
|
||||
let file = File::open(path)?;
|
||||
let reader = io::BufReader::new(file);
|
||||
|
|
Loading…
Reference in a new issue