use alloy_checked_math_core::CheckedMathError;
use alloy_checked_math_macro::{checked, unchecked};
fn safe_example(x: i32) -> Result<i32, CheckedMathError> {
let x = checked! { 1 / x };
return Ok(x);
}
fn explicit_unsafe_example(x: i32) -> i32 {
let x = unchecked! { 1 / x };
return x;
}
fn implicit_unsafe_example(x: i32) -> i32 {
let x = 1 / x; // warning will be here
return x;
}
#[test]
fn test_all_math_is_checked() {
alloy_checked_math_lint::assert_checked(
Path::new(env!("CARGO_MANIFEST_DIR")).join("src")
);
}-
Notifications
You must be signed in to change notification settings - Fork 0
BarterLab/alloy-checked-math
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published