Skip to content

Commit 65c8eae

Browse files
committed
removed redundant use statements and removed some return statements
1 parent b7444de commit 65c8eae

File tree

4 files changed

+12
-18
lines changed

4 files changed

+12
-18
lines changed

src/main.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ mod text_effects;
55
mod utils;
66
use std::os::unix::fs::{FileTypeExt, MetadataExt};
77
use structopt::StructOpt;
8-
use termion;
98

109
struct Directory {
1110
paths: Vec<File>,
@@ -142,14 +141,14 @@ impl Directory {
142141
for p in paths {
143142
if p
144143
.file_name()
145-
.unwrap()
146-
.to_str()
147-
.unwrap()
148-
.to_lowercase()
149-
.contains(&dir.display().to_string().to_lowercase())
150-
{
151-
new_paths.push(File::new(p))
152-
}
144+
.unwrap()
145+
.to_str()
146+
.unwrap()
147+
.to_lowercase()
148+
.contains(&dir.display().to_string().to_lowercase())
149+
{
150+
new_paths.push(File::new(p))
151+
}
153152
}
154153

155154
if new_paths.is_empty() {
@@ -403,9 +402,9 @@ impl std::fmt::Debug for File {
403402
if input::Cli::from_args().created_time {
404403
time = &self.created;
405404
}
406-
write!(
405+
writeln!(
407406
f,
408-
"{} {}{} {}{} {} {}{} {}\n",
407+
"{} {}{} {}{} {} {}{} {}",
409408
self.perms,
410409
termion::color::Fg(termion::color::LightGreen),
411410
self.size,

src/utils/file_times.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
use chrono;
2-
use filetime;
3-
41
pub fn modified(file: std::path::PathBuf, format: String) -> String {
52
if file.symlink_metadata().unwrap().modified().is_ok() && filetime::FileTime::from_creation_time(&file.symlink_metadata().unwrap()).is_some(){
63
let naive = chrono::NaiveDateTime::from_timestamp(
@@ -13,7 +10,7 @@ pub fn modified(file: std::path::PathBuf, format: String) -> String {
1310
chrono::DateTime::from_utc(naive, *chrono::Local::now().offset());
1411
datetime.format(&format).to_string()
1512
} else {
16-
return "00 000 00:00:00".to_string()
13+
"00 000 00:00:00".to_string()
1714
}
1815
}
1916

@@ -30,6 +27,6 @@ pub fn created(file: std::path::PathBuf, format: String) -> String {
3027
chrono::DateTime::from_utc(naive, *chrono::Local::now().offset());
3128
datetime.format(&format).to_string()
3229
} else {
33-
return "00 000 00:00:00".to_string()
30+
"00 000 00:00:00".to_string()
3431
}
3532
}

src/utils/get_group.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::os::unix::fs::MetadataExt;
2-
use users;
32

43
pub fn group(path: std::path::PathBuf) -> String {
54
String::from(

src/utils/get_user.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::os::unix::fs::MetadataExt;
2-
use users;
32

43
pub fn user(path: std::path::PathBuf) -> String {
54
String::from(

0 commit comments

Comments
 (0)