Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 497a0931 authored by Ulya Trafimovich's avatar Ulya Trafimovich
Browse files

Drop `strings.HasPrefix` when guarding `strings.TrimPrefix`.

There is no need to check as `TrimPrefix` does nothing if the prefix
doesn't match (see https://pkg.go.dev/strings#TrimPrefix).

Bug: 193425964
Test: m nothing
Change-Id: Ieb82e72a471800e29eb6bb54308041a9ab4173e5
parent 39924233
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ package java
import (
	"fmt"
	"path/filepath"
	"strings"

	"github.com/google/blueprint"
	"github.com/google/blueprint/proptools"
@@ -1462,11 +1461,7 @@ func (j *Import) IDECustomizedModuleName() string {
	// TODO(b/113562217): Extract the base module name from the Import name, often the Import name
	// has a prefix "prebuilt_". Remove the prefix explicitly if needed until we find a better
	// solution to get the Import name.
	name := j.Name()
	if strings.HasPrefix(name, removedPrefix) {
		name = strings.TrimPrefix(name, removedPrefix)
	}
	return name
	return android.RemoveOptionalPrebuiltPrefix(j.Name())
}

var _ android.PrebuiltInterface = (*Import)(nil)
+1 −1
Original line number Diff line number Diff line
@@ -179,7 +179,7 @@ func (r *robolectricTest) GenerateAndroidBuildActions(ctx android.ModuleContext)
			continue
		} else if strings.HasSuffix(s, "/BaseRobolectricTest.java") {
			continue
		} else if strings.HasPrefix(s, "src/") {
		} else {
			s = strings.TrimPrefix(s, "src/")
		}
		r.tests = append(r.tests, s)