rust: replace for loop with any()

This is a little cleaner, and short circuits correctly, unlike the loop
it replaces
This commit is contained in:
Dylan Baker 2021-02-23 11:26:19 -08:00
parent 6544f151db
commit 0edd005804
1 changed files with 1 additions and 4 deletions

View File

@ -1630,10 +1630,7 @@ int dummy;
if d == '': if d == '':
d = '.' d = '.'
args += ['-L', d] args += ['-L', d]
has_shared_deps = False has_shared_deps = any(isinstance(dep, build.SharedLibrary) for dep in target.get_dependencies())
for dep in target.get_dependencies():
if isinstance(dep, build.SharedLibrary):
has_shared_deps = True
if isinstance(target, build.SharedLibrary) or has_shared_deps: if isinstance(target, build.SharedLibrary) or has_shared_deps:
# add prefer-dynamic if any of the Rust libraries we link # add prefer-dynamic if any of the Rust libraries we link
# against are dynamic, otherwise we'll end up with # against are dynamic, otherwise we'll end up with