Skip to content

Commit

Permalink
tuple deconstruction in get_author_field
Browse files Browse the repository at this point in the history
  • Loading branch information
o2sh committed Oct 27, 2020
1 parent acc68d9 commit a51b2f7
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/onefetch/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,23 +668,25 @@ impl Info {

let pad = title.len() + 2;

for (i, author) in self.authors.iter().enumerate() {
for (i, (author_name, author_nbr_commits, autor_contribution)) in
self.authors.iter().enumerate()
{
if i == 0 {
author_field.push_str(&format!(
"{}{} {} {}\n",
author.2.to_string().color(self.color_set.info),
autor_contribution.to_string().color(self.color_set.info),
"%".color(self.color_set.info),
author.0.to_string().color(self.color_set.info),
author.1.to_string().color(self.color_set.info),
author_name.to_string().color(self.color_set.info),
author_nbr_commits.to_string().color(self.color_set.info),
));
} else {
author_field.push_str(&format!(
"{:<width$}{}{} {} {}\n",
"",
author.2.to_string().color(self.color_set.info),
autor_contribution.to_string().color(self.color_set.info),
"%".color(self.color_set.info),
author.0.to_string().color(self.color_set.info),
author.1.to_string().color(self.color_set.info),
author_name.to_string().color(self.color_set.info),
author_nbr_commits.to_string().color(self.color_set.info),
width = pad
));
}
Expand Down Expand Up @@ -747,7 +749,7 @@ impl Info {
if tags_str.is_empty() && branches_str.is_empty() {
String::new()
} else if branches_str.is_empty() || tags_str.is_empty() {
format!("({})", format!("{}{}", tags_str, branches_str))
format!("({}{})", tags_str, branches_str)
} else {
format!("({}, {})", branches_str, tags_str)
}
Expand Down

0 comments on commit a51b2f7

Please sign in to comment.