rust: fully disable all lints when no_lint is set
If the no_lint attribute is set, we now explicitly disable any warning
or error.
Bug: 162897623
Test: cd external/selinux; mma; check the build log for warnings
Change-Id: I5338bda77ab25ded7cc43cc3afd29419fcbd9808
diff --git a/rust/compiler.go b/rust/compiler.go
index 0274015..c39a4a1 100644
--- a/rust/compiler.go
+++ b/rust/compiler.go
@@ -159,7 +159,9 @@
func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flags {
- if !Bool(compiler.Properties.No_lint) {
+ if Bool(compiler.Properties.No_lint) {
+ flags.RustFlags = append(flags.RustFlags, config.AllowAllLints)
+ } else {
flags.RustFlags = append(flags.RustFlags, config.RustcLintsForDir(ctx.ModuleDir()))
}
flags.RustFlags = append(flags.RustFlags, compiler.Properties.Flags...)
diff --git a/rust/config/lints.go b/rust/config/lints.go
index 529d094..e24ffac 100644
--- a/rust/config/lints.go
+++ b/rust/config/lints.go
@@ -128,6 +128,7 @@
{"vendor/google", rustcDefault, true, clippyDefault},
{"vendor/", rustcVendor, true, clippyVendor},
}
+var AllowAllLints = rustcAllowAll
// ClippyLintsForDir returns a boolean if Clippy should be executed and if so, the lints to be used.
func ClippyLintsForDir(dir string) (bool, string) {