From 04067fcad7fbf6cfbf1b8656caa8ec51e217e321 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 30 Dec 2024 09:54:16 +0100 Subject: clippy: skip running it if --cap-lints allow is included in the command line Meson builds libraries before running clippy, thus all dependencies must be present and clippy is run only for the warnings (instead, Cargo treats clippy as a separate toolchain and builds everything). In Meson's case thus it is pointless to run clippy whenever --cap-lints allow is included in the command line. Signed-off-by: Paolo Bonzini --- mesonbuild/scripts/clippy.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'mesonbuild/scripts') diff --git a/mesonbuild/scripts/clippy.py b/mesonbuild/scripts/clippy.py index a5161462c..c4746e3fd 100644 --- a/mesonbuild/scripts/clippy.py +++ b/mesonbuild/scripts/clippy.py @@ -41,15 +41,24 @@ class ClippyDriver: cmdlist = list(clippy) prev = None + lints_cap = None for arg in src_block['parameters']: - if prev: + if prev == '--cap-lints': + cmdlist.append(prev) + lints_cap = arg + prev = None + elif prev: prev = None continue - elif arg in {'--emit', '--out-dir'}: + if arg in {'--emit', '--out-dir', '--cap-lints'}: prev = arg else: cmdlist.append(arg) + # no use in running clippy if it wouldn't print anything anyway + if lints_cap == 'allow': + break + cmdlist.extend(src_block['sources']) # the default for --emit is to go all the way to linking, # and --emit dep-info= is not enough for clippy to do -- cgit v1.2.3