Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rust-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ permissions:

jobs:
rust-ci:
uses: hyperpolymath/standards/.github/workflows/rust-ci-reusable.yml@d135b05bfc647d0c0fbfedc7e80f37ea50f49236
uses: hyperpolymath/standards/.github/workflows/rust-ci-reusable.yml@8dc2bf039d1ff0372d650895c46bea7fbaec68ff
4 changes: 2 additions & 2 deletions src/abi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,8 @@ mod tests {

#[test]
fn test_custom_distribution_valid() {
let d =
Distribution::new_custom("mixture(0.5, normal(0,1), normal(5,2))".to_string()).expect("TODO: handle error");
let d = Distribution::new_custom("mixture(0.5, normal(0,1), normal(5,2))".to_string())
.expect("TODO: handle error");
assert_eq!(d.kind(), "custom");
}

Expand Down
15 changes: 10 additions & 5 deletions src/codegen/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ fn emit_header(code: &mut String, project_name: &str) {
writeln!(code, "// Project: {}", project_name).expect("TODO: handle error");
writeln!(code, "// SPDX-License-Identifier: MPL-2.0").expect("TODO: handle error");
writeln!(code).expect("TODO: handle error");
writeln!(code, "module {} where", sanitize_identifier(project_name)).expect("TODO: handle error");
writeln!(code, "module {} where", sanitize_identifier(project_name))
.expect("TODO: handle error");
writeln!(code).expect("TODO: handle error");
}

Expand All @@ -78,7 +79,8 @@ fn emit_distribution_declarations(code: &mut String, variables: &[ParsedVariable
let btype = betlang_type(&var.distribution);

writeln!(code, "/// {} — {}", var.name, info.description).expect("TODO: handle error");
writeln!(code, "/// Sampling method: {}", info.sampling_method).expect("TODO: handle error");
writeln!(code, "/// Sampling method: {}", info.sampling_method)
.expect("TODO: handle error");
writeln!(code, "/// Support: {}", info.support).expect("TODO: handle error");
writeln!(
code,
Expand Down Expand Up @@ -113,15 +115,17 @@ fn emit_ternary_helpers(code: &mut String, variables: &[ParsedVariable]) {
writeln!(code).expect("TODO: handle error");

writeln!(code, "/// Kleene strong three-valued AND").expect("TODO: handle error");
writeln!(code, "let ternary_and(a: Ternary, b: Ternary) -> Ternary =").expect("TODO: handle error");
writeln!(code, "let ternary_and(a: Ternary, b: Ternary) -> Ternary =")
.expect("TODO: handle error");
writeln!(code, " match (a, b) with").expect("TODO: handle error");
writeln!(code, " | (False, _) | (_, False) -> False").expect("TODO: handle error");
writeln!(code, " | (True, True) -> True").expect("TODO: handle error");
writeln!(code, " | _ -> Unknown").expect("TODO: handle error");
writeln!(code).expect("TODO: handle error");

writeln!(code, "/// Kleene strong three-valued OR").expect("TODO: handle error");
writeln!(code, "let ternary_or(a: Ternary, b: Ternary) -> Ternary =").expect("TODO: handle error");
writeln!(code, "let ternary_or(a: Ternary, b: Ternary) -> Ternary =")
.expect("TODO: handle error");
writeln!(code, " match (a, b) with").expect("TODO: handle error");
writeln!(code, " | (True, _) | (_, True) -> True").expect("TODO: handle error");
writeln!(code, " | (False, False) -> False").expect("TODO: handle error");
Expand Down Expand Up @@ -191,7 +195,8 @@ fn emit_entry_point(code: &mut String, variables: &[ParsedVariable], config: &Ab
}

writeln!(code, " }}").expect("TODO: handle error");
writeln!(code, " report(results, confidence={})", config.confidence).expect("TODO: handle error");
writeln!(code, " report(results, confidence={})", config.confidence)
.expect("TODO: handle error");
}

/// Sanitize a project name into a valid Betlang module identifier.
Expand Down
Loading