diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d25e569bc..0e005b735 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -220,8 +220,8 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable - components: rustfmt + toolchain: nightly + components: rustfmt, clippy override: true - name: run rustfmt uses: actions-rs/cargo@v1 diff --git a/stdlib/src/zlib.rs b/stdlib/src/zlib.rs index 7d861a7e9..330ddc89e 100644 --- a/stdlib/src/zlib.rs +++ b/stdlib/src/zlib.rs @@ -154,7 +154,7 @@ mod zlib { fn header_from_wbits(wbits: OptionalArg, vm: &VirtualMachine) -> PyResult { let wbits = wbits.unwrap_or(MAX_WBITS as i8); let header = wbits > 0; - let wbits = wbits.abs() as u8; + let wbits = wbits.unsigned_abs(); match wbits { 9..=15 => Ok(InitOptions::Standard { header, diff --git a/vm/src/cformat.rs b/vm/src/cformat.rs index 7e1267f77..09f7dd979 100644 --- a/vm/src/cformat.rs +++ b/vm/src/cformat.rs @@ -599,8 +599,8 @@ fn try_update_quantity_from_tuple<'a, I: Iterator>( Some(CFormatQuantity::FromValuesTuple) => match elements.next() { Some(width_obj) => { if let Some(i) = width_obj.payload::() { - let i = i.try_to_primitive::(vm)?.abs() as usize; - *q = Some(CFormatQuantity::Amount(i)); + let i = i.try_to_primitive::(vm)?.unsigned_abs(); + *q = Some(CFormatQuantity::Amount(i as usize)); Ok(()) } else { Err(vm.new_type_error("* wants int".to_owned())) @@ -953,7 +953,7 @@ where break; } } - return Ok(Some(CFormatQuantity::Amount(num.abs() as usize))); + return Ok(Some(CFormatQuantity::Amount(num.unsigned_abs() as usize))); } } Ok(None)