summaryrefslogtreecommitdiff
path: root/rust/builder.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2023-10-26 14:01:51 -0700
committer Colin Cross <ccross@android.com> 2023-11-02 19:07:49 +0000
commitf96b001064c2dcdd8038f0aa03c372aaa2f2a132 (patch)
tree0f7aec36ec069ee076459198b602203d201d906c /rust/builder.go
parent4e6c3ef59be1266e06b4de9a519c5ac81b4c5c75 (diff)
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
Diffstat (limited to 'rust/builder.go')
-rw-r--r--rust/builder.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/rust/builder.go b/rust/builder.go
index 72e5be18b..162d1aab0 100644
--- a/rust/builder.go
+++ b/rust/builder.go
@@ -288,7 +288,7 @@ func transformSrctoCrate(ctx ModuleContext, main android.Path, deps PathDeps, fl
}
// 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 @@ func Rustdoc(ctx ModuleContext, main android.Path, deps PathDeps,
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")
}