diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2019-04-22 15:54:16 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2019-04-25 12:28:51 -0700 |
commit | 5678468c2cc1f4639c68a95fb71f8212c846459b (patch) | |
tree | eeedb656ffa320932b052043355e297809b90633 /mesonbuild/mintro.py | |
parent | 8e1670cc60cc853c7ddc81dceb65dc93fa45bfa9 (diff) | |
download | meson-5678468c2cc1f4639c68a95fb71f8212c846459b.zip meson-5678468c2cc1f4639c68a95fb71f8212c846459b.tar.gz meson-5678468c2cc1f4639c68a95fb71f8212c846459b.tar.bz2 |
Don't use len() to test for container emptiness
I ran the numbers once before (it's in the meson history) but it's
*much* faster to *not* use len for testing if a container is empty or
not.
Diffstat (limited to 'mesonbuild/mintro.py')
-rw-r--r-- | mesonbuild/mintro.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index 32931b6..a4a6978 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -343,7 +343,7 @@ def list_projinfo_from_source(sourcedir: str, intr: IntrospectionInterpreter): return intr.project_data def print_results(options, results, indent): - if len(results) == 0 and not options.force_dict: + if not results and not options.force_dict: print('No command specified') return 1 elif len(results) == 1 and not options.force_dict: @@ -487,7 +487,7 @@ def write_meson_info_file(builddata: build.Build, errors: list, build_files_upda 'build_files_updated': build_files_updated, } - if len(errors) > 0: + if errors: info_data['error'] = True info_data['error_list'] = [x if isinstance(x, str) else str(x) for x in errors] else: |