Replace assert! with debug_assert! in production code paths.
This allows the assertions to be disabled in release builds, so that the code is faster and smaller, at the expense of not performing the checks. Assertions can be re-enabled in release builds with the debug-assertions flag in Cargo.toml, as the top-level Cargo.toml file does.
This commit is contained in:
@@ -15,14 +15,14 @@ pub struct Variable(u32);
|
||||
impl Variable {
|
||||
/// Create a new Variable with the given index.
|
||||
pub fn with_u32(index: u32) -> Self {
|
||||
assert!(index < u32::MAX);
|
||||
debug_assert!(index < u32::MAX);
|
||||
Variable(index)
|
||||
}
|
||||
}
|
||||
|
||||
impl EntityRef for Variable {
|
||||
fn new(index: usize) -> Self {
|
||||
assert!(index < (u32::MAX as usize));
|
||||
debug_assert!(index < (u32::MAX as usize));
|
||||
Variable(index as u32)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user