diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2021-08-31 09:55:01 -0700 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2021-08-31 16:28:54 -0400 |
commit | 4d7031437c7a81b52c776d4ae1e32741bdb851ca (patch) | |
tree | 7716c4af0d3f43b450a7c94dd42ae5dbef8ebdff /mesonbuild/compilers | |
parent | 06fdb29daace9ebe55e5df5336f65cba304773d2 (diff) | |
download | meson-4d7031437c7a81b52c776d4ae1e32741bdb851ca.zip meson-4d7031437c7a81b52c776d4ae1e32741bdb851ca.tar.gz meson-4d7031437c7a81b52c776d4ae1e32741bdb851ca.tar.bz2 |
pylint: turn on superflous-parens
We have a lot of these. Some of them are harmless, if unidiomatic, such
as `if (condition)`, others are potentially dangerous `assert(...)`, as
`assert(condtion)` works as expected, but `assert(condition, message)`
will result in an assertion that never triggers, as what you're actually
asserting is `bool(tuple[2])`, which will always be true.
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r-- | mesonbuild/compilers/cpp.py | 4 | ||||
-rw-r--r-- | mesonbuild/compilers/d.py | 4 | ||||
-rw-r--r-- | mesonbuild/compilers/mixins/clike.py | 2 | ||||
-rw-r--r-- | mesonbuild/compilers/mixins/visualstudio.py | 4 |
4 files changed, 7 insertions, 7 deletions
diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index 1e46f26..168ba7a 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -119,7 +119,7 @@ class CPPCompiler(CLikeCompiler, Compiler): def _test_cpp_std_arg(self, cpp_std_value: str) -> bool: # Test whether the compiler understands a -std=XY argument - assert(cpp_std_value.startswith('-std=')) + assert cpp_std_value.startswith('-std=') # This test does not use has_multi_arguments() for two reasons: # 1. has_multi_arguments() requires an env argument, which the compiler @@ -155,7 +155,7 @@ class CPPCompiler(CLikeCompiler, Compiler): } # Currently, remapping is only supported for Clang, Elbrus and GCC - assert(self.id in frozenset(['clang', 'lcc', 'gcc', 'emscripten'])) + assert self.id in frozenset(['clang', 'lcc', 'gcc', 'emscripten']) if cpp_std not in CPP_FALLBACKS: # 'c++03' and 'c++98' don't have fallback types diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py index eb1cf74..19706c5 100644 --- a/mesonbuild/compilers/d.py +++ b/mesonbuild/compilers/d.py @@ -443,7 +443,7 @@ class DmdLikeCompilerMixin(CompilerMixinBase): if crt_val in self.mscrt_args: return self.mscrt_args[crt_val] - assert(crt_val in ['from_buildtype', 'static_from_buildtype']) + assert crt_val in ['from_buildtype', 'static_from_buildtype'] dbg = 'mdd' rel = 'md' @@ -463,7 +463,7 @@ class DmdLikeCompilerMixin(CompilerMixinBase): elif buildtype == 'minsize': return self.mscrt_args[rel] else: - assert(buildtype == 'custom') + assert buildtype == 'custom' raise EnvironmentException('Requested C runtime based on buildtype, but buildtype is "custom".') def get_soname_args(self, env: 'Environment', prefix: str, shlib_name: str, diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py index ccf14a4..d978f69 100644 --- a/mesonbuild/compilers/mixins/clike.py +++ b/mesonbuild/compilers/mixins/clike.py @@ -456,7 +456,7 @@ class CLikeCompiler(Compiler): # on MSVC compiler and linker flags must be separated by the "/link" argument # at this point, the '/link' argument may already be part of extra_args, otherwise, it is added here - if self.linker_to_compiler_args([]) == ['/link'] and largs != [] and not ('/link' in extra_args): + if self.linker_to_compiler_args([]) == ['/link'] and largs != [] and not '/link' in extra_args: extra_args += ['/link'] args = cargs + extra_args + largs diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py index e911f64..eb81764 100644 --- a/mesonbuild/compilers/mixins/visualstudio.py +++ b/mesonbuild/compilers/mixins/visualstudio.py @@ -342,7 +342,7 @@ class VisualStudioLikeCompiler(Compiler, metaclass=abc.ABCMeta): def get_crt_compile_args(self, crt_val: str, buildtype: str) -> T.List[str]: if crt_val in self.crt_args: return self.crt_args[crt_val] - assert(crt_val in ['from_buildtype', 'static_from_buildtype']) + assert crt_val in ['from_buildtype', 'static_from_buildtype'] dbg = 'mdd' rel = 'md' if crt_val == 'static_from_buildtype': @@ -360,7 +360,7 @@ class VisualStudioLikeCompiler(Compiler, metaclass=abc.ABCMeta): elif buildtype == 'minsize': return self.crt_args[rel] else: - assert(buildtype == 'custom') + assert buildtype == 'custom' raise mesonlib.EnvironmentException('Requested C runtime based on buildtype, but buildtype is "custom".') def has_func_attribute(self, name: str, env: 'Environment') -> T.Tuple[bool, bool]: |