Skip to content

Commit 1dce926

Browse files
committed
remove unnecessary regex usage
1 parent 05d5c23 commit 1dce926

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/etc/rust_types.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ class RustType(Enum):
5858
STD_PATHBUF_REGEX = re.compile(r"^(std::([a-z_]+::)+)PathBuf$")
5959
STD_PATH_REGEX = re.compile(r"^&(mut )?(std::([a-z_]+::)+)Path$")
6060

61-
TUPLE_ITEM_REGEX = re.compile(r"__\d+$")
62-
6361
ENCODED_ENUM_PREFIX = "RUST$ENCODED$ENUM$"
6462
ENUM_DISR_FIELD_NAME = "<<variant>>"
6563
ENUM_LLDB_ENCODED_VARIANTS = "$variants$"
@@ -88,7 +86,12 @@ class RustType(Enum):
8886

8987

9088
def is_tuple_fields(fields: List) -> bool:
91-
return all(TUPLE_ITEM_REGEX.match(str(field.name)) for field in fields)
89+
for f in fields:
90+
name = str(f.name)
91+
if not name.startswith("__") or not name[2:].isdigit():
92+
return False
93+
94+
return True
9295

9396

9497
def classify_struct(name: str, fields: List) -> RustType:

0 commit comments

Comments
 (0)