mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-27 15:14:31 +00:00
Replace std::string::find == 0 with StringRef::startswith
This is both more readable and faster. Found by clang-tidy's abseil-string-find-startswith.
This commit is contained in:
1 parent
03f43b3aca
commit
e8f13f4f62
7 files changed
+9
-8
No files matched your search
@@ -5140,10 +5140,10 @@ uint32_t ObjectFileMachO::GetDependentModules(FileSpecList &files) {
|
||||
std::string loader_path("@loader_path");
|
||||
std::string executable_path("@executable_path");
|
||||
for (auto &rpath : rpath_paths) {
|
||||
if (rpath.find(loader_path) == 0) {
|
||||
if (llvm::StringRef(rpath).startswith(loader_path)) {
|
||||
rpath.erase(0, loader_path.size());
|
||||
rpath.insert(0, this_file_spec.GetDirectory().GetCString());
|
||||
} else if (rpath.find(executable_path) == 0) {
|
||||
} else if (llvm::StringRef(rpath).startswith(executable_path)) {
|
||||
rpath.erase(0, executable_path.size());
|
||||
rpath.insert(0, this_file_spec.GetDirectory().GetCString());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user