Skip to content

Commit c68e021

Browse files
committedOct 8, 2020
Clarify variable names
1 parent 5044179 commit c68e021

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

Diff for: ‎src/info.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -489,13 +489,13 @@ impl Info {
489489

490490
fn get_authors(git_history: &[String], n: usize) -> Vec<(String, usize, usize)> {
491491
let mut authors = std::collections::HashMap::new();
492-
let mut names = std::collections::HashMap::new();
492+
let mut author_name_by_email = std::collections::HashMap::new();
493493
let mut total_commits = 0;
494494
for line in git_history {
495-
let commit_author = line.split('\t').collect::<Vec<_>>()[1].to_string();
495+
let author_email = line.split('\t').collect::<Vec<_>>()[1].to_string();
496496
let author_name = line.split('\t').collect::<Vec<_>>()[2].to_string();
497-
let commit_count = authors.entry(commit_author.to_string()).or_insert(0);
498-
names.entry(commit_author.to_string()).or_insert(author_name);
497+
let commit_count = authors.entry(author_email.to_string()).or_insert(0);
498+
author_name_by_email.entry(author_email.to_string()).or_insert(author_name);
499499
*commit_count += 1;
500500
total_commits += 1;
501501
}
@@ -509,7 +509,7 @@ impl Info {
509509
.into_iter()
510510
.map(|(author, count)| {
511511
(
512-
names.get(&author).unwrap().trim_matches('\'').to_string(),
512+
author_name_by_email.get(&author).unwrap().trim_matches('\'').to_string(),
513513
count,
514514
count * 100 / total_commits,
515515
)

0 commit comments

Comments
 (0)
Please sign in to comment.