Skip to content

Commit 1779fb3

Browse files
committed
rustfmt
1 parent dc5c4fc commit 1779fb3

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

Diff for: src/main.rs

+24-12
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,21 @@ impl fmt::Display for Info {
1717
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1818
let mut s = String::from("\n");
1919
let color = get_color(&self.language);
20-
s.push_str(&("Project: ".color(color).bold().to_string() + &format!("{}\n", self.project_name)));
21-
s.push_str(&("Language: ".color(color).bold().to_string() + &format!("{}\n", self.language)));
20+
s.push_str(
21+
&("Project: ".color(color).bold().to_string() + &format!("{}\n", self.project_name)),
22+
);
23+
s.push_str(
24+
&("Language: ".color(color).bold().to_string() + &format!("{}\n", self.language)),
25+
);
2226
s.push_str(&("Author: ".color(color).bold().to_string() + &format!("{}\n", self.author)));
2327
s.push_str(&("Repo: ".color(color).bold().to_string() + &format!("{}\n", self.repo)));
24-
s.push_str(&("Number of lines: ".color(color).bold().to_string() + &format!("{}\n", self.number_of_lines)));
28+
s.push_str(
29+
&("Number of lines: ".color(color).bold().to_string()
30+
+ &format!("{}\n", self.number_of_lines)),
31+
);
2532
s.push_str(&("License: ".color(color).bold().to_string() + &format!("{}\n", self.license)));
2633

27-
let logo= self.get_ascii();
34+
let logo = self.get_ascii();
2835
let mut lines = s.lines();
2936
let left_pad = logo.lines().map(|l| l.len()).max().unwrap_or(0);
3037
let mut o = String::new();
@@ -33,7 +40,12 @@ impl fmt::Display for Info {
3340
Some(line) => line,
3441
None => "",
3542
};
36-
o.push_str(&format!("{:width$} {}\n", a.color(color).bold(), b, width = left_pad));
43+
o.push_str(&format!(
44+
"{:width$} {}\n",
45+
a.color(color).bold(),
46+
b,
47+
width = left_pad
48+
));
3749
}
3850

3951
write!(f, "{}", o)
@@ -58,7 +70,7 @@ enum Language {
5870
TypeScript,
5971
}
6072

61-
fn get_color(l : &Language) -> &str {
73+
fn get_color(l: &Language) -> &str {
6274
match l {
6375
Language::C => "cyan",
6476
Language::Clojure => "cyan",
@@ -101,7 +113,6 @@ impl fmt::Display for Language {
101113
}
102114

103115
fn main() {
104-
105116
let language = match get_dominant_language() {
106117
Some(language) => language,
107118
None => {
@@ -121,19 +132,20 @@ fn main() {
121132
};
122133

123134
println!("{}", info);
124-
125135
}
126136

127137
/// Traverse current directory and search for dominant
128138
/// language using tokei.
129139
fn get_dominant_language() -> Option<Language> {
130140
let mut languages = tokei::Languages::new();
131141
let required_languages = get_all_language_types();
132-
languages.get_statistics( &["."], vec![".git", "target"], Some(required_languages));
142+
languages.get_statistics(&["."], vec![".git", "target"], Some(required_languages));
133143

134-
languages.remove_empty().iter()
135-
.max_by_key(|(_, v)| v.code)
136-
.map(|(k, _)| Language::from(**k))
144+
languages
145+
.remove_empty()
146+
.iter()
147+
.max_by_key(|(_, v)| v.code)
148+
.map(|(k, _)| Language::from(**k))
137149
}
138150

139151
/// Convert from tokei LanguageType to known Language type .

0 commit comments

Comments
 (0)