Visitar URL original
CI: Run clippy on more features (#8916) · RustPython/RustPython@ab3d759 · GitHub
Skip to content

Commit ab3d759

Browse files
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.
1 parent 68dbf4f commit ab3d759

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ concurrency:
2121
env:
2222
CARGO_ARGS: --no-default-features --features stdlib,importlib,stdio,encodings,sqlite,ssl-rustls-aws-lc,host_env,doc
2323
CARGO_ARGS_NO_SSL: --no-default-features --features stdlib,importlib,stdio,encodings,sqlite,host_env,doc
24+
CARGO_ARGS_MOST_FEATS: --features capi,encodings,jit,sqlite,threading
2425
# Crates excluded from workspace builds:
2526
# - rustpython_wasm: requires wasm target
2627
# - rustpython-venvlauncher: Windows-only
@@ -685,7 +686,7 @@ jobs:
685686
continue-on-error: true
686687

687688
- name: Clippy
688-
run: cargo clippy --locked --keep-going ${{ env.CARGO_ARGS }} --workspace --all-targets ${{ env.WORKSPACE_EXCLUDES }} -- -Dwarnings
689+
run: cargo clippy --locked --keep-going ${{ env.CARGO_ARGS_MOST_FEATS }} --workspace --all-targets --bins --examples --tests ${{ env.WORKSPACE_EXCLUDES }} -- -Dwarnings
689690

690691
# macOS/Windows clippy uses the same OS-surface filter as cargo check.
691692
# Force with the run:cross-check label. Check names stay clippy (<os>).

‎crates/vm/src/builtins/function/jit.rs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ pub(super) enum ArgsError {
3131
impl ToPyObject for AbiValue {
3232
fn to_pyobject(self, vm: &VirtualMachine) -> PyObjectRef {
3333
match self {
34-
AbiValue::Int(i) => i.to_pyobject(vm),
35-
AbiValue::Float(f) => f.to_pyobject(vm),
36-
AbiValue::Bool(b) => b.to_pyobject(vm),
34+
Self::Int(i) => i.to_pyobject(vm),
35+
Self::Float(f) => f.to_pyobject(vm),
36+
Self::Bool(b) => b.to_pyobject(vm),
3737
_ => unimplemented!(),
3838
}
3939
}
@@ -164,20 +164,20 @@ pub(crate) fn get_jit_args<'a>(
164164
vm: &VirtualMachine,
165165
) -> Result<Args<'a>, ArgsError> {
166166
let mut jit_args = jitted_code.args_builder();
167-
let nargs = func_args.args.len();
168167

169168
let code: &Py<PyCode> = &func.code;
170169
let arg_names = code.arg_names();
171170
let arg_count = code.arg_count;
172171
let posonlyarg_count = code.posonlyarg_count;
173172

173+
let nargs = func_args.args.len();
174174
if nargs > arg_count as usize || nargs < posonlyarg_count as usize {
175175
return Err(ArgsError::WrongNumberOfArgs);
176176
}
177177

178178
// Add positional arguments
179-
for i in 0..nargs {
180-
jit_args.set(i, get_jit_value(vm, &func_args.args[i])?)?;
179+
for (i, args) in func_args.args.iter().enumerate() {
180+
jit_args.set(i, get_jit_value(vm, args)?)?;
181181
}
182182

183183
// Handle keyword arguments

‎crates/vm/src/types/slot.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ impl PyAtomicTypeFlags {
365365
pub fn replace_masked(&self, mask: PyTypeFlags, value: PyTypeFlags) {
366366
let mask_bits = mask.bits();
367367
let value_bits = (value & mask).bits();
368-
let _ = self.0.fetch_update(
368+
let _ = self.0.try_update(
369369
core::sync::atomic::Ordering::AcqRel,
370370
core::sync::atomic::Ordering::Acquire,
371371
|old| Some((old & !mask_bits) | value_bits),

0 commit comments

Comments
 (0)