util/glsl2spirv: use if x in str instead of str.find

The latter is only idiomatically used when a start and/or stop position
is required.

Reviewed-by: Luis Felipe Strano Moraes <luis.strano@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19449>
This commit is contained in:
Dylan Baker
2022-11-01 13:28:18 -07:00
committed by Marge Bot
parent 5488fa80dd
commit 7c88c3a05b
+3 -3
View File
@@ -86,7 +86,7 @@ def create_include_guard(lines: T.List[str], filename: str) -> T.List[str]:
# remove '#pragma once'
for idx, l in enumerate(lines):
if l.find('#pragma once') != -1:
if '#pragma once' in l:
lines.pop(idx)
break
@@ -95,7 +95,7 @@ def create_include_guard(lines: T.List[str], filename: str) -> T.List[str]:
def convert_to_static_variable(lines: T.List[str], varname: str) -> T.List[str]:
for idx, l in enumerate(lines):
if l.find(varname) != -1:
if varname in l:
lines[idx] = "static " + lines[idx]
return lines
raise RuntimeError(f'Did not find {varname}, this is unexpected')
@@ -103,7 +103,7 @@ def convert_to_static_variable(lines: T.List[str], varname: str) -> T.List[str]:
def override_version(lines: T.List[str], glsl_version: str) -> T.List[str]:
for idx, l in enumerate(lines):
if l.find('#version ') != -1:
if '#version ' in l:
lines[idx] = "#version {}\n".format(glsl_version)
return lines
raise RuntimeError('Did not find #version directive, this is unexpected')