Skip to content

Commit

Permalink
wit-component: minor code simplification in linking.rs (bytecodeallia…
Browse files Browse the repository at this point in the history
…nce#1259)

This is a follow-up to bytecodealliance#1258, in which I missed a chance to simplify the code a
bit.

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
  • Loading branch information
dicej authored Oct 20, 2023
1 parent dc5c0c5 commit e18b17f
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions crates/wit-component/src/linking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1279,21 +1279,17 @@ impl Linker {
}
}

let mut exporters = resolve_exporters(&metadata)?;
let exporters = resolve_exporters(&metadata)?;

let cabi_realloc_exporter = exporters
.get_mut(&ExportKey {
.get(&ExportKey {
name: "cabi_realloc",
ty: Type::Function(FunctionType {
parameters: vec![ValueType::I32; 4],
results: vec![ValueType::I32],
}),
})
.map(|exporters| {
let first = *exporters.first().unwrap();
*exporters = vec![first];
first.0
});
.map(|exporters| exporters.first().unwrap().0);

let (exporters, missing, _) = resolve_symbols(&metadata, &exporters);

Expand Down

0 comments on commit e18b17f

Please sign in to comment.