Skip to content

Commit a0e2d0a

Browse files
committed
Formatted the project using rustfmt
1 parent 668c696 commit a0e2d0a

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

Diff for: src/main.rs

+20-15
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@ impl fmt::Display for Info {
2222
s.push_str(
2323
&("Project: ".color(color).bold().to_string() + &format!("{}\n", self.project_name)),
2424
);
25-
25+
2626
s.push_str(
2727
&("Language: ".color(color).bold().to_string() + &format!("{}\n", self.language)),
2828
);
29-
29+
3030
if self.authors.len() > 0 {
31-
let title = if self.authors.len() > 1 { "Authors: " } else { "Author: " };
31+
let title = if self.authors.len() > 1 {
32+
"Authors: "
33+
} else {
34+
"Author: "
35+
};
3236

3337
let first = self.authors.first().unwrap();
3438
s.push_str(&(title.color(color).bold().to_string() + &format!("{}\n", first)));
@@ -39,7 +43,7 @@ impl fmt::Display for Info {
3943
s.push_str(&(title.color(color).bold().to_string() + &format!("{}\n", author)));
4044
}
4145
}
42-
46+
4347
s.push_str(&("Repo: ".color(color).bold().to_string() + &format!("{}\n", self.repo)));
4448
s.push_str(
4549
&("Number of lines: ".color(color).bold().to_string()
@@ -166,20 +170,20 @@ fn project_languages() -> tokei::Languages {
166170

167171
fn is_git_installed() -> bool {
168172
Command::new("git")
169-
.arg("--version")
170-
.stdout(Stdio::null())
171-
.status()
172-
.is_ok()
173+
.arg("--version")
174+
.stdout(Stdio::null())
175+
.status()
176+
.is_ok()
173177
}
174178

175179
// Return first n most active commiters as authors within this project.
176180
fn get_authors(n: usize) -> Vec<String> {
177181
use std::collections::HashMap;
178182
let output = Command::new("git")
179-
.arg("log")
180-
.arg("--format='%aN'")
181-
.output()
182-
.expect("Failed to execute git.");
183+
.arg("log")
184+
.arg("--format='%aN'")
185+
.output()
186+
.expect("Failed to execute git.");
183187

184188
// create map for storing author name as a key and their commit count as value
185189
let mut authors = HashMap::new();
@@ -198,9 +202,10 @@ fn get_authors(n: usize) -> Vec<String> {
198202

199203
// get only authors without their commit count
200204
// and string "'" prefix and suffix
201-
let authors: Vec<String> = authors.into_iter()
202-
.map(|(author, _)| author.trim_matches('\'').to_string())
203-
.collect();
205+
let authors: Vec<String> = authors
206+
.into_iter()
207+
.map(|(author, _)| author.trim_matches('\'').to_string())
208+
.collect();
204209

205210
authors
206211
}

0 commit comments

Comments
 (0)