chore: Fix two compiler warnings (#33421)

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2024-09-12 06:24:05 -07:00 committed by GitHub
parent b1486d311a
commit 37ab4b9825
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View file

@ -6755,12 +6755,15 @@ class CGDictionary(CGThing):
initParent = f"parent: {initParent},\n" if initParent else ""
memberInits = CGList([memberInit(m, True) for m in self.memberInfo])
unsafe_if_necessary = "unsafe"
if not initParent and not memberInits:
unsafe_if_necessary = ""
return (
f"impl {selfName} {{\n"
f"{CGIndenter(CGGeneric(self.makeEmpty()), indentLevel=4).define()}\n"
" pub fn new(cx: SafeJSContext, val: HandleValue) \n"
f" -> Result<ConversionResult<{actualType}>, ()> {{\n"
" unsafe {\n"
f" {unsafe_if_necessary} {{\n"
" let object = if val.get().is_null_or_undefined() {\n"
" ptr::null_mut()\n"
" } else if val.get().is_object() {\n"