Skip to content

Commit

Permalink
const fn
Browse files Browse the repository at this point in the history
  • Loading branch information
asukaminato0721 committed Nov 30, 2024
1 parent a3338d2 commit 0d59528
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ rustup default nightly
rustup update

rustup component add rustfmt
rustup component add clippy

cargo fmt --check

Expand Down
2 changes: 1 addition & 1 deletion src/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl Parameters {
(self.w[4] - f64::exp(self.w[5] * (rating_int as f64 - 1.0)) + 1.0).clamp(1.0, 10.0)
}

pub fn init_stability(&self, rating: Rating) -> f64 {
pub const fn init_stability(&self, rating: Rating) -> f64 {
let rating_int: i32 = rating as i32;
self.w[(rating_int - 1) as usize].max(0.1)
}
Expand Down

0 comments on commit 0d59528

Please sign in to comment.