diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2022-03-23 18:59:52 -0400 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2022-03-24 12:27:06 -0400 |
commit | b66a477bbcffb05b740d4f58246b0e47b9c247a1 (patch) | |
tree | 7107772f9e15c2034fab281483bae6838c31c7cc /mesonbuild/build.py | |
parent | c8c8aeef0fcc6aba31b8d4775cfaec368f102604 (diff) | |
download | meson-b66a477bbcffb05b740d4f58246b0e47b9c247a1.zip meson-b66a477bbcffb05b740d4f58246b0e47b9c247a1.tar.gz meson-b66a477bbcffb05b740d4f58246b0e47b9c247a1.tar.bz2 |
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.
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r-- | mesonbuild/build.py | 20 |
1 files changed, 1 insertions, 19 deletions
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: ''' |