Don't call android.PathForModuleSrc(ctx).String() to get ModuleDir
ctx.ModuleDir is much cheaper than android.PathForModuleSrc(ctx).String().
Test: builds
Change-Id: I81819088d9564b06a0336a59a45f2b110b0bd9d6
diff --git a/rust/builder.go b/rust/builder.go
index 72e5be1..162d1aa 100644
--- a/rust/builder.go
+++ b/rust/builder.go
@@ -288,7 +288,7 @@
}
// Disallow experimental features
- modulePath := android.PathForModuleSrc(ctx).String()
+ modulePath := ctx.ModuleDir()
if !(android.IsThirdPartyPath(modulePath) || strings.HasPrefix(modulePath, "prebuilts")) {
rustcFlags = append(rustcFlags, "-Zallow-features=\"\"")
}
@@ -436,7 +436,7 @@
docTimestampFile := android.PathForModuleOut(ctx, "rustdoc.timestamp")
// Silence warnings about renamed lints for third-party crates
- modulePath := android.PathForModuleSrc(ctx).String()
+ modulePath := ctx.ModuleDir()
if android.IsThirdPartyPath(modulePath) {
rustdocFlags = append(rustdocFlags, " -A warnings")
}