Skip to content

Commit 54d4cc9

Browse files
committed
build: fix compiler error
1 parent bbaef05 commit 54d4cc9

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/build/caller_utils_generator.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,14 @@ fn find_interfaces_in_world(api_dir: &Path, world_name: &str) -> Result<Vec<Stri
276276
if !content.contains("world ") {
277277
continue;
278278
}
279-
if let Some(world_line) = content.lines().find(|line| line.trim().starts_with("world ")) {
280-
if let Some(name) = world_line.trim().split_whitespace().nth(1) {
281-
let clean_name = name.trim_end_matches(" {").trim_start_matches('%');
282-
world_defs.insert(clean_name.to_string(), content);
283-
debug!(file = %path.display(), world = %clean_name, "Indexed world definition");
284-
}
279+
let world_name = content
280+
.lines()
281+
.find(|line| line.trim().starts_with("world "))
282+
.and_then(|world_line| world_line.trim().split_whitespace().nth(1))
283+
.map(|name| name.trim_end_matches(" {").trim_start_matches('%').to_string());
284+
if let Some(clean_name) = world_name {
285+
world_defs.insert(clean_name.clone(), content);
286+
debug!(file = %path.display(), world = %clean_name, "Indexed world definition");
285287
}
286288
}
287289

0 commit comments

Comments
 (0)