Skip to content

Commit

Permalink
Fix clippy (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathaniel-daniel committed Oct 4, 2023
1 parent c4dc8c1 commit 9b23888
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Install wasm-pack
run: cargo install wasm-pack
run: cargo install wasm-pack --force

- name: Build
run: cargo build --all --verbose
Expand Down
7 changes: 3 additions & 4 deletions src/file_time.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![warn(clippy::integer_arithmetic)]
#![warn(clippy::arithmetic_side_effects)]

use std::time::Duration;
use std::time::SystemTime;
Expand Down Expand Up @@ -109,9 +109,8 @@ impl TryFrom<FileTime> for SystemTime {
.map_err(|_| TryFromFileTimeError::Unspecified)?;
let offset_seconds = Duration::from_secs(secs_part);
// 0 < the # of nanoseonds in a second < u64::MAX
// Clippy: I don't think this can overflow/panic fo u64s.
#[allow(clippy::integer_arithmetic)]
let nanos_part = u64::try_from(nanos % u128::from(NANOSECONDS_PER_SECOND)).unwrap();
let nanos_part =
u64::try_from(nanos.rem_euclid(u128::from(NANOSECONDS_PER_SECOND))).unwrap();
let offset_nanos = Duration::from_nanos(nanos_part);
let offset = offset_seconds
.checked_add(offset_nanos)
Expand Down

0 comments on commit 9b23888

Please sign in to comment.