Skip to content

Commit 08647db

Browse files
committed
Silence Rust unused_unsafe warnings conditionally
1 parent 2708426 commit 08647db

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packTab/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,10 @@ def declare_function(self, linkage, retType, name, args):
380380
return "%sfn %s (%s) -> %s" % (linkage, name, args, retType)
381381

382382
def print_function(self, name, function, *, print=print):
383+
if self.unsafe_array_access:
384+
print("#[allow(dead_code, unused_parens, unused_unsafe)]")
385+
else:
386+
print("#[allow(dead_code, unused_parens)]")
383387
# Add #[inline] attribute for better optimization hints
384388
if function.inline_always:
385389
print("#[inline(always)]")

0 commit comments

Comments
 (0)