Skip to content

Commit

Permalink
Make compute_minmax an inline function
Browse files Browse the repository at this point in the history
  • Loading branch information
giovannitangredi authored and Luni-4 committed Mar 4, 2022
1 parent ec0183a commit fd348f2
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/metrics/cognitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ impl Stats {
pub(crate) fn compute_sum(&mut self) {
self.structural_sum += self.structural;
}
#[inline(always)]
pub(crate) fn compute_minmax(&mut self) {
self.structural_min = self.structural_min.min(self.structural);
self.structural_max = self.structural_max.max(self.structural);
Expand Down
1 change: 1 addition & 0 deletions src/metrics/cyclomatic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ impl Stats {
pub(crate) fn compute_sum(&mut self) {
self.cyclomatic_sum += self.cyclomatic;
}
#[inline(always)]
pub(crate) fn compute_minmax(&mut self) {
self.cyclomatic_max = self.cyclomatic_max.max(self.cyclomatic);
self.cyclomatic_min = self.cyclomatic_min.min(self.cyclomatic);
Expand Down
1 change: 1 addition & 0 deletions src/metrics/exit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ impl Stats {
pub(crate) fn compute_sum(&mut self) {
self.exit_sum += self.exit;
}
#[inline(always)]
pub(crate) fn compute_minmax(&mut self) {
self.exit_max = self.exit_max.max(self.exit);
self.exit_min = self.exit_min.min(self.exit);
Expand Down
1 change: 1 addition & 0 deletions src/metrics/nargs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ impl Stats {
self.closure_nargs_sum += self.closure_nargs;
self.fn_nargs_sum += self.fn_nargs;
}
#[inline(always)]
pub(crate) fn compute_minmax(&mut self) {
self.closure_nargs_min = self.closure_nargs_min.min(self.closure_nargs);
self.closure_nargs_max = self.closure_nargs_max.max(self.closure_nargs);
Expand Down
1 change: 1 addition & 0 deletions src/metrics/nom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ impl Stats {
self.functions_sum += self.functions;
self.closures_sum += self.closures;
}
#[inline(always)]
pub(crate) fn compute_minmax(&mut self) {
self.functions_min = self.functions_min.min(self.functions);
self.functions_max = self.functions_max.max(self.functions);
Expand Down

0 comments on commit fd348f2

Please sign in to comment.