1
0
Fork 0
mirror of https://github.com/Findus23/prettypwd.git synced 2024-09-18 14:03:50 +02:00

add clippy feedback

This commit is contained in:
Lukas Winkler 2022-02-05 21:43:52 +01:00
parent 2010101b98
commit ed802ff909
Signed by: lukas
GPG key ID: 54DE4D798D244853
3 changed files with 4 additions and 4 deletions

2
Cargo.lock generated
View file

@ -4,4 +4,4 @@ version = 3
[[package]]
name = "prettypwd"
version = "0.1.0"
version = "0.1.1"

View file

@ -1,6 +1,6 @@
[package]
name = "prettypwd"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
[dependencies]

View file

@ -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() {