Skip to content

Commit

Permalink
Update compiler/noirc_frontend/src/hir_def/types.rs
Browse files Browse the repository at this point in the history
Co-authored-by: jfecher <[email protected]>
  • Loading branch information
michaeljklein and jfecher authored Oct 9, 2024
1 parent aacd45a commit eb42951
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions compiler/noirc_frontend/src/hir_def/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,19 +250,10 @@ impl Kind {
}

/// Ensure the given value fits in self.integral_maximum_size()
pub(crate) fn ensure_value_fits<T>(&self, value: T) -> Option<T>
where
for<'a> &'a FieldElement: From<&'a T>,
{
fn ensure_value_fits(&self, value: FieldElement) -> Option<FieldElement> {
match self.integral_maximum_size() {
None => Some(value),
Some(maximum_size) => {
if <&T as Into<&FieldElement>>::into(&value) <= &maximum_size {
Some(value)
} else {
None
}
}
Some(maximum_size) => (value <= maximum_size).then_some(value),
}
}
}
Expand Down

0 comments on commit eb42951

Please sign in to comment.