Skip to content

Commit cd4aa46

Browse files
committed
fix: address code review
Signed-off-by: Tomasz Andrzejak <andreiltd@gmail.com>
1 parent a7bbdf5 commit cd4aa46

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

src/hyperlight_component_macro/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ struct BindgenInputParams {
119119
fn source_or_env(source: Option<util::WitSource>) -> util::WitSource {
120120
source.unwrap_or_else(|| {
121121
util::WitSource::Wasm(std::path::PathBuf::from(
122-
std::env::var_os("WIT_WORLD").unwrap(),
122+
std::env::var_os("WIT_WORLD")
123+
.expect("WIT_WORLD must be set when bindgen input is omitted"),
123124
))
124125
})
125126
}

src/hyperlight_component_util/tests/wasmtime_guest_codegen.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,19 @@ fn wasmtime_guest_codegen_emits_wasmtime_flags_macro() {
7777
fn read_wit_type_accepts_wasm_encoded_wit() {
7878
let wasm_path =
7979
encode_wit_fixture_to_wasm(&fixture_path("../tests/rust_guests/witguest/guest.wit"));
80-
let kebab_name = util::read_wit_type(
80+
let (kebab_name, has_import_or_export) = util::read_wit_type(
8181
util::WitSource::Wasm(wasm_path.clone()),
8282
None,
8383
|kebab_name, ct| {
84-
assert!(!ct.imports.is_empty() || !ct.instance.unqualified.exports.is_empty());
85-
kebab_name
84+
(
85+
kebab_name,
86+
!ct.imports.is_empty() || !ct.instance.unqualified.exports.is_empty(),
87+
)
8688
},
8789
);
88-
std::fs::remove_file(wasm_path).expect("temporary wasm fixture should be removed");
90+
std::fs::remove_file(&wasm_path).expect("temporary wasm fixture should be removed");
8991

92+
assert!(has_import_or_export);
9093
assert_eq!(kebab_name, "test:wit/test");
9194
}
9295

0 commit comments

Comments
 (0)