From 235d76e9d25e23b72019bc29617bf3359c38bd59 Mon Sep 17 00:00:00 2001 From: Vaibhav Nagarnaik Date: Thu, 5 May 2022 16:56:47 +0000 Subject: [PATCH] tools/clippy: Allow json formatted output This helps with integration of `tools/clippy` in `rust-analyzer` and potentially other IDEs which can parse the json output better than the text output. TEST=Ran it with `rust-analyzer` in VSCode. Change-Id: Iceb2748994cbbacf48dc473a9ad06eec567beb0a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3630700 Reviewed-by: Dennis Kempin Commit-Queue: Vaibhav Nagarnaik Tested-by: kokoro Reviewed-by: Daniel Verkamp --- tools/clippy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/clippy b/tools/clippy index c65f9fc24b..7cefa0b21b 100755 --- a/tools/clippy +++ b/tools/clippy @@ -30,12 +30,13 @@ def is_crate_excluded(crate: str) -> bool: return crate in excluded_crates -def main(fix: bool = False): +def main(fix: bool = False, json: bool = False): chdir(CROSVM_ROOT) # Note: Clippy checks are configured in .cargo/config.toml common_args = [ "--fix" if fix else None, + "--message-format=json" if json else None, "--all-targets", "--", "-Dwarnings",