aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/rust.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-05-17 10:42:57 -0700
committerDylan Baker <dylan@pnwbakers.com>2021-09-24 18:48:48 -0700
commit30202a24021587b7d7ddffd8312eb5b425b3e273 (patch)
tree8b03d4b62f0b35a520f8f5ef859df7156cd62395 /mesonbuild/compilers/rust.py
parentf0a7b6e7c6bf97b22f3e5f1d600717ac7ba4162f (diff)
downloadmeson-30202a24021587b7d7ddffd8312eb5b425b3e273.zip
meson-30202a24021587b7d7ddffd8312eb5b425b3e273.tar.gz
meson-30202a24021587b7d7ddffd8312eb5b425b3e273.tar.bz2
compilers/rust: Add support for clippy
Clippy is a compiler wrapper for rust that provides an extra layer of linting. It's quite popular, but unfortunately doesn't provide the output of the compiler that it's wrapping in it's output, so we don't detect that clippy is rustc. This small patch adds a new compiler class (that is the Rustc class with a different id) and the necessary logic to detect that clippy is in fact rustc) Fixes: #8767
Diffstat (limited to 'mesonbuild/compilers/rust.py')
-rw-r--r--mesonbuild/compilers/rust.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py
index 2337ceb..9423b2d 100644
--- a/mesonbuild/compilers/rust.py
+++ b/mesonbuild/compilers/rust.py
@@ -196,3 +196,20 @@ class RustCompiler(Compiler):
# Rustc currently has no way to toggle this, it's controlled by whether
# pic is on by rustc
return []
+
+
+class ClippyRustCompiler(RustCompiler):
+
+ """Clippy is a linter that wraps Rustc.
+
+ This just provides us a different id
+ """
+
+ def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice,
+ is_cross: bool, info: 'MachineInfo',
+ exe_wrapper: T.Optional['ExternalProgram'] = None,
+ full_version: T.Optional[str] = None,
+ linker: T.Optional['DynamicLinker'] = None):
+ super().__init__(exelist, version, for_machine, is_cross, info,
+ exe_wrapper, full_version, linker)
+ self.id = 'clippy-driver rustc'