Skip to content

Commit

Permalink
clippy: skip running it if --cap-lints allow is included in the comma…
Browse files Browse the repository at this point in the history
…nd 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 <[email protected]>
  • Loading branch information
bonzini authored and jpakkane committed Jan 8, 2025
1 parent 211f1ca commit 04067fc
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions mesonbuild/scripts/clippy.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,24 @@ def __call__(self, target: T.Dict[str, T.Any]) -> T.Iterable[T.Coroutine[None, N

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
Expand Down

0 comments on commit 04067fc

Please sign in to comment.