From 1d8e20d744bae14ab3814125e6d9ac28b9fc97e3 Mon Sep 17 00:00:00 2001 From: Matthew Maurer Date: Mon, 20 Nov 2023 21:18:12 +0000 Subject: rust: internalize srcPathFromModuleSrcs This was frequently misused (for example, in the prebuilts module, it was used as a complex "assert(len(srcs))==1"), and can be superceded by getCrateRoot anywhere it was used. It's now only called from compiler.go, and can drop the second return parameter, as it was only actually used by the prebuilt assert misuse. Bug: 309943184 Test: m nothing Change-Id: I6c92580bc8f0ecb7586c544056b5409e6dd280e7 --- rust/compiler.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'rust/compiler.go') diff --git a/rust/compiler.go b/rust/compiler.go index 98bbcb645..899502a64 100644 --- a/rust/compiler.go +++ b/rust/compiler.go @@ -541,7 +541,7 @@ func (compiler *baseCompiler) relativeInstallPath() string { func (compiler *baseCompiler) crateRootPath(ctx ModuleContext) android.Path { if compiler.Properties.Crate_root == nil { - path, _ := srcPathFromModuleSrcs(ctx, compiler.Properties.Srcs) + path := srcPathFromModuleSrcs(ctx, compiler.Properties.Srcs) return path } else { return android.PathForModuleSrc(ctx, *compiler.Properties.Crate_root) @@ -549,7 +549,7 @@ func (compiler *baseCompiler) crateRootPath(ctx ModuleContext) android.Path { } // Returns the Path for the main source file along with Paths for generated source files from modules listed in srcs. -func srcPathFromModuleSrcs(ctx ModuleContext, srcs []string) (android.Path, android.Paths) { +func srcPathFromModuleSrcs(ctx ModuleContext, srcs []string) android.Path { if len(srcs) == 0 { ctx.PropertyErrorf("srcs", "srcs must not be empty") } @@ -580,5 +580,5 @@ func srcPathFromModuleSrcs(ctx ModuleContext, srcs []string) (android.Path, andr // TODO: b/297264540 - once all modules are sandboxed, we need to select the proper // entry point file from Srcs rather than taking the first one paths := android.PathsForModuleSrc(ctx, srcs) - return paths[srcIndex], paths[1:] + return paths[srcIndex] } -- cgit v1.2.3-59-g8ed1b