Skip to content

Commit

Permalink
chore: Fix formatting for Rust 1.81.0, rustfmt 1.7.1-stable
Browse files Browse the repository at this point in the history
  • Loading branch information
cstepanian authored and alilleybrinker committed Sep 5, 2024
1 parent 1f71a56 commit e24b697
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
9 changes: 5 additions & 4 deletions hipcheck/src/data/query/fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ fn fuzz_check(db: &dyn FuzzProvider) -> Result<Fuzz> {

log::debug!("repo url {}", repo_uri);

let token =
db.github_api_token().ok_or_else(|| {
Error::msg("missing GitHub token with permissions for accessing public repository data in config")
})?;
let token = db.github_api_token().ok_or_else(|| {
Error::msg(
"missing GitHub token with permissions for accessing public repository data in config",
)
})?;

let fuzz = get_fuzz_check(&token, repo_uri)?;

Expand Down
3 changes: 2 additions & 1 deletion hipcheck/src/metric/commit_trust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ pub fn commit_trust_metric(db: &dyn MetricProvider) -> Result<Arc<CommitTrustOut

*trust_map
.entry(commit_view.commit.hash.to_string())
.or_insert(true) = (email == &commit_view.committer.email || email == &commit_view.author.email)
.or_insert(true) = (email == &commit_view.committer.email
|| email == &commit_view.author.email)
&& count.count >= value_threshold;
}
}
Expand Down
14 changes: 7 additions & 7 deletions hipcheck/src/metric/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ pub fn mean(data: &[f64]) -> Option<f64> {
pub fn std_dev(mean: f64, data: &[f64]) -> Option<f64> {
match (mean, data.len()) {
(mean, count) if count > 0 => {
let variance = data
.iter()
.map(|value| {
let diff = mean - *value;
diff * diff
})
.sum::<f64>() / count as f64;
let variance =
data.iter()
.map(|value| {
let diff = mean - *value;
diff * diff
})
.sum::<f64>() / count as f64;

Some(variance.sqrt())
}
Expand Down

0 comments on commit e24b697

Please sign in to comment.