Skip to content

Commit

Permalink
style: run cargo clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
0xCCF4 committed Jul 15, 2024
1 parent 724667e commit eaf87f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/sanitize_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl From<u32> for TrustedDataType {

impl SanitizeValue<TrustedDataType, ()> for UserDataType {
fn sanitize_value(self) -> Result<TrustedDataType, ()> {
Ok((self.data.abs() as u32).into())
Ok(self.data.unsigned_abs().into())
}
}

Expand Down
5 changes: 2 additions & 3 deletions examples/sanitize_with.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ fn main() {
let user_input = UntrustedValue::from(user_input);

let trusted_value: u32 = user_input
.clone()
.sanitize_with(|value| Ok::<u32, ()>(value.abs() as u32))
.sanitize_with(|value| Ok::<u32, ()>(value.unsigned_abs()))
.expect("Sanitization failed");

println!("Sanitized value: {:?}", trusted_value);
Expand All @@ -19,7 +18,7 @@ fn main() {
if value < -100 {
Err("Failed to sanitize value")
} else {
Ok(value.abs() as u32)
Ok(value.unsigned_abs())
}
})
.expect("Sanitization failed");
Expand Down

0 comments on commit eaf87f5

Please sign in to comment.