CI: Run clippy on more features (#8916)

Clippy doesn't run on everything which is why I keep accidentally
uncovering new lints to fix. I updated CI to run clippy on all features,
except tk, as well as all binaries, examples, and tests. That should
cover everything.

Tk currently doesn't build (at least for me), so that feature is still
disabled in CI.

While here, fix some of the lints that are now raised.
This commit is contained in:
Joshua Megnauth authored and GitHub committed 2026-10-01 00:59:00 +00:00
1 parent 68dbf4f4c4
commit ab3d759e74
3 files changed
+9 -8

No files matched your search

+2 -1
View File
@@ -21,6 +21,7 @@ concurrency:
env:
CARGO_ARGS: --no-default-features --features stdlib,importlib,stdio,encodings,sqlite,ssl-rustls-aws-lc,host_env,doc
CARGO_ARGS_NO_SSL: --no-default-features --features stdlib,importlib,stdio,encodings,sqlite,host_env,doc
CARGO_ARGS_MOST_FEATS: --features capi,encodings,jit,sqlite,threading
# Crates excluded from workspace builds:
# - rustpython_wasm: requires wasm target
# - rustpython-venvlauncher: Windows-only
@@ -685,7 +686,7 @@ jobs:
continue-on-error: true
- name: Clippy
run: cargo clippy --locked --keep-going ${{ env.CARGO_ARGS }} --workspace --all-targets ${{ env.WORKSPACE_EXCLUDES }} -- -Dwarnings
run: cargo clippy --locked --keep-going ${{ env.CARGO_ARGS_MOST_FEATS }} --workspace --all-targets --bins --examples --tests ${{ env.WORKSPACE_EXCLUDES }} -- -Dwarnings
# macOS/Windows clippy uses the same OS-surface filter as cargo check.
# Force with the run:cross-check label. Check names stay clippy (<os>).
+6 -6
View File
@@ -31,9 +31,9 @@ pub(super) enum ArgsError {
impl ToPyObject for AbiValue {
fn to_pyobject(self, vm: &VirtualMachine) -> PyObjectRef {
match self {
AbiValue::Int(i) => i.to_pyobject(vm),
AbiValue::Float(f) => f.to_pyobject(vm),
AbiValue::Bool(b) => b.to_pyobject(vm),
Self::Int(i) => i.to_pyobject(vm),
Self::Float(f) => f.to_pyobject(vm),
Self::Bool(b) => b.to_pyobject(vm),
_ => unimplemented!(),
}
}
@@ -164,20 +164,20 @@ pub(crate) fn get_jit_args<'a>(
vm: &VirtualMachine,
) -> Result<Args<'a>, ArgsError> {
let mut jit_args = jitted_code.args_builder();
let nargs = func_args.args.len();
let code: &Py<PyCode> = &func.code;
let arg_names = code.arg_names();
let arg_count = code.arg_count;
let posonlyarg_count = code.posonlyarg_count;
let nargs = func_args.args.len();
if nargs > arg_count as usize || nargs < posonlyarg_count as usize {
return Err(ArgsError::WrongNumberOfArgs);
}
// Add positional arguments
for i in 0..nargs {
jit_args.set(i, get_jit_value(vm, &func_args.args[i])?)?;
for (i, args) in func_args.args.iter().enumerate() {
jit_args.set(i, get_jit_value(vm, args)?)?;
}
// Handle keyword arguments
+1 -1
View File
@@ -365,7 +365,7 @@ impl PyAtomicTypeFlags {
pub fn replace_masked(&self, mask: PyTypeFlags, value: PyTypeFlags) {
let mask_bits = mask.bits();
let value_bits = (value & mask).bits();
let _ = self.0.fetch_update(
let _ = self.0.try_update(
core::sync::atomic::Ordering::AcqRel,
core::sync::atomic::Ordering::Acquire,
|old| Some((old & !mask_bits) | value_bits),