Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrgn committed Dec 26, 2023
1 parent 3b37b60 commit 703ece9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@1.74.1
with:
components: clippy
- run: cargo clippy --all-features
- run: cargo clippy --all-features -- -D warnings

rustfmt:
name: Rustfmt
Expand Down
8 changes: 4 additions & 4 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl Humidity {
return Err(HumidityError::OutOfRange);
}

let integer = if val >= 256.0 || val < 0.0 {
let integer = if !(0.0..256.0).contains(&val) {
return Err(HumidityError::OutOfRange);
} else {
val.trunc() as u8
Expand All @@ -103,10 +103,10 @@ impl Humidity {
}
}

impl Into<f32> for Humidity {
impl From<Humidity> for f32 {
/// Convert a `Humidity` instance to a f32.
fn into(self) -> f32 {
f32::from(self.integer) + (f32::from(self.fractional) / 256.0)
fn from(val: Humidity) -> Self {
f32::from(val.integer) + (f32::from(val.fractional) / 256.0)
}
}

Expand Down

0 comments on commit 703ece9

Please sign in to comment.