From b66a477bbcffb05b740d4f58246b0e47b9c247a1 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Wed, 23 Mar 2022 18:59:52 -0400 Subject: build.py: Simplify uses_rust() There is no need to check all source files again, if there are .rs sources then rust compiler is in self.compilers already. --- mesonbuild/build.py | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'mesonbuild/build.py') diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 00a737a..e762dca 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -1582,25 +1582,7 @@ You probably should put it in link_with instead.''') raise AssertionError(f'Could not get a dynamic linker for build target {self.name!r}') def uses_rust(self) -> bool: - """Is this target a rust target.""" - if self.sources: - first_file = self.sources[0] - if first_file.fname.endswith('.rs'): - return True - elif self.generated: - if self.generated[0].get_outputs()[0].endswith('.rs'): - return True - elif self.structured_sources: - for v in self.structured_sources.sources.values(): - for s in v: - if isinstance(s, (str, File)): - if s.endswith('.rs'): - return True - else: - for ss in s.get_outputs(): - if ss.endswith('.rs'): - return True - return False + return 'rust' in self.compilers def get_using_msvc(self) -> bool: ''' -- cgit v1.1