Skip to content

Commit 70ec479

Browse files
committed
fix: apply clippy fixes
1 parent ab1d874 commit 70ec479

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

crates/spidermonkey-embedding-splicer/src/bindgen.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,13 +1117,12 @@ impl EsmBindgen {
11171117
} else {
11181118
expt_name
11191119
};
1120-
if let Some(alias) = interface_name_from_string(expt_name_sans_version) {
1121-
if !self.exports.contains_key(&alias)
1120+
if let Some(alias) = interface_name_from_string(expt_name_sans_version)
1121+
&& !self.exports.contains_key(&alias)
11221122
&& !self.export_aliases.values().any(|_alias| &alias == _alias)
11231123
{
11241124
self.export_aliases.insert(expt_name.to_string(), alias);
11251125
}
1126-
}
11271126
}
11281127
}
11291128

@@ -1292,12 +1291,12 @@ fn interface_name_from_string(name: &str) -> Option<String> {
12921291
let name = &name[path_idx + 1..];
12931292
let at_idx = name.rfind('@');
12941293
let alias = name[..at_idx.unwrap_or(name.len())].to_lower_camel_case();
1295-
let iface_name = Some(if let Some(at_idx) = at_idx {
1294+
1295+
Some(if let Some(at_idx) = at_idx {
12961296
format!("{alias}_{}", name[at_idx + 1..].replace(['.', '-'], "_"))
12971297
} else {
12981298
alias
1299-
});
1300-
iface_name
1299+
})
13011300
}
13021301

13031302
fn binding_name(func_name: &str, iface_name: &Option<String>) -> String {

crates/spidermonkey-embedding-splicer/src/splice.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,11 +563,11 @@ fn synthesize_import_functions(
563563

564564
// stack the return arg now as it chains with the
565565
// args we're about to add to the stack
566-
if impt_sig.ret.is_some() {
566+
if let Some(ret) = impt_sig.ret {
567567
func.local_get(vp_arg);
568568

569569
// if an i64 return, then we need to stack the extra BigInt constructor arg for that now
570-
if matches!(impt_sig.ret.unwrap(), CoreTy::I64) {
570+
if matches!(ret, CoreTy::I64) {
571571
func.local_get(ctx_arg);
572572
}
573573
}
@@ -726,7 +726,7 @@ fn synthesize_import_functions(
726726

727727
// create imported function table
728728
let els = module.elements.iter_mut().next().unwrap();
729-
if let ElementItems::Functions(ref mut funcs) = &mut els.items {
729+
if let ElementItems::Functions(funcs) = &mut els.items {
730730
for fid in import_fnids {
731731
funcs.push(fid);
732732
}

0 commit comments

Comments
 (0)