Skip to content

Commit

Permalink
cargo clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
o2sh committed Dec 24, 2022
1 parent c1b2660 commit 71bfde0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn main() -> Result<(), Box<dyn Error>> {
&std::fs::read_to_string("src/info/langs/language.tera")?,
&Context::from_value(serde_json::json!({ "languages": lang_data, }))?,
)?;
fs::write(&output_path, rust_code)?;
fs::write(output_path, rust_code)?;

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion src/info/langs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn get_language_distribution(languages: &tokei::Languages) -> Option<HashMap<Lan
language_distribution.insert(Language::from(*language_name), code as f64);
}

let total: f64 = language_distribution.iter().map(|(_, v)| v).sum();
let total: f64 = language_distribution.values().sum();

if total.abs() < f64::EPSILON {
None
Expand Down
5 changes: 1 addition & 4 deletions src/info/repo/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,7 @@ fn get_number_of_tags(repo: &Repository) -> Result<usize> {

fn get_number_of_branches(repo: &Repository) -> Result<usize> {
let mut number_of_branches = repo.references()?.remote_branches()?.count();
if number_of_branches > 0 {
//Exclude origin/HEAD -> origin/main
number_of_branches -= 1;
}
number_of_branches = number_of_branches.saturating_sub(1); //Exclude origin/HEAD -> origin/main
Ok(number_of_branches)
}

Expand Down

0 comments on commit 71bfde0

Please sign in to comment.