Skip to content

Commit

Permalink
Make calculate_avg private since it's not public interface
Browse files Browse the repository at this point in the history
  • Loading branch information
havenwood committed May 17, 2024
1 parent f6d1f2d commit acb384d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl WordTally {

/// Calculates an approximate mean average word count if there are words.
/// Note: Casting `u64` to `f64` and floating point arithmatic cause a loss of precision.
pub fn calculate_avg(count: u64, uniq_count: usize) -> Option<f64> {
fn calculate_avg(count: u64, uniq_count: usize) -> Option<f64> {
(count > 0).then(|| count as f64 / uniq_count as f64)
}

Expand Down

0 comments on commit acb384d

Please sign in to comment.