Skip to content

Commit

Permalink
add vim swap files to gitignore, follow some clippy suggesstions
Browse files Browse the repository at this point in the history
  • Loading branch information
Phate6660 committed Feb 25, 2021
1 parent 2e3c199 commit 78cd3c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
/target
Cargo.lock

[._]*.s[a-v][a-z]
*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
14 changes: 6 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ pub fn cpu() -> io::Result<String> {
true => info(file, 1),
false => info(file, 4),
}
} else if shared_functions::exit_code() != 1 {
info(file, 1)
} else {
if shared_functions::exit_code() != 1 {
info(file, 1)
} else {
info(file, 4)
}
info(file, 4)
}
}

Expand Down Expand Up @@ -201,11 +199,11 @@ pub fn memory() -> io::Result<String> {
const DIVISOR_U64: u64 = 1024;
const UNIT_MB: &str = "MB";

pub trait ToIOResult<T> {
pub trait ToIoResult<T> {
fn to_io_result(self) -> io::Result<T>;
}

impl<T, E: ToString> ToIOResult<T> for Result<T, E> {
impl<T, E: ToString> ToIoResult<T> for Result<T, E> {
fn to_io_result(self) -> io::Result<T> {
match self {
Ok(x) => Ok(x),
Expand Down Expand Up @@ -331,7 +329,7 @@ pub fn terminal() -> io::Result<String> {
let process_id = terminal::ppid(File::open(path)?).trim().replace("\n", "");
let process_name = terminal::name(process_id.clone()).trim().replace("\n", "");
let info = terminal::info(process_name, process_id).unwrap();
if info == "systemd" || info == "" {
if info == "systemd" || info.is_empty() {
Ok("N/A (could not determine the terminal, this could be an issue of using tmux)".to_string())
} else {
Ok(info)
Expand Down

0 comments on commit 78cd3c7

Please sign in to comment.