From 0edd0058046069f715d753dddee6e6c08e79207d Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 23 Feb 2021 11:26:19 -0800 Subject: rust: replace for loop with any() This is a little cleaner, and short circuits correctly, unlike the loop it replaces --- mesonbuild/backend/ninjabackend.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index a0a34b34d..b7723ef79 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1630,10 +1630,7 @@ int dummy; if d == '': d = '.' args += ['-L', d] - has_shared_deps = False - for dep in target.get_dependencies(): - if isinstance(dep, build.SharedLibrary): - has_shared_deps = True + has_shared_deps = any(isinstance(dep, build.SharedLibrary) for dep in target.get_dependencies()) if isinstance(target, build.SharedLibrary) or has_shared_deps: # add prefer-dynamic if any of the Rust libraries we link # against are dynamic, otherwise we'll end up with -- cgit v1.2.3