mirror of
https://github.com/Findus23/prettypwd.git
synced 2024-09-19 15:13:49 +02:00
add clippy feedback
This commit is contained in:
parent
2010101b98
commit
ed802ff909
3 changed files with 4 additions and 4 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -4,4 +4,4 @@ version = 3
|
|||
|
||||
[[package]]
|
||||
name = "prettypwd"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "prettypwd"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::env;
|
|||
|
||||
fn simplify_string(pwd: String, home: String) -> String {
|
||||
let prettyhome = pwd.replacen(home.as_str(), "/~", 1);
|
||||
let dirs: Vec<&str> = prettyhome.split("/").collect();
|
||||
let dirs: Vec<&str> = prettyhome.split('/').collect();
|
||||
let mut print_dirs: Vec<&str> = Vec::new();
|
||||
if dirs.len() > 4 {
|
||||
if dirs[1] != "~" {
|
||||
|
@ -17,7 +17,7 @@ fn simplify_string(pwd: String, home: String) -> String {
|
|||
print_dirs = dirs
|
||||
}
|
||||
// println!("{:#?}", print_dirs);
|
||||
return print_dirs.join("/").replacen("/~", "~", 1);
|
||||
print_dirs.join("/").replacen("/~", "~", 1)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
Loading…
Reference in a new issue