Use debug_assert!.

This commit is contained in:
Stephen Chung 2023-02-12 00:13:54 +08:00
parent 8685323b15
commit 9f18d6519d
5 changed files with 6 additions and 6 deletions

View File

@ -185,7 +185,7 @@ impl FnCallHashes {
#[inline(always)] #[inline(always)]
#[must_use] #[must_use]
pub fn script(&self) -> u64 { pub fn script(&self) -> u64 {
assert!(self.script.is_some()); debug_assert!(self.script.is_some());
self.script.unwrap() self.script.unwrap()
} }
} }

View File

@ -20,7 +20,7 @@ impl Engine {
global: &GlobalRuntimeState, global: &GlobalRuntimeState,
namespace: &crate::ast::Namespace, namespace: &crate::ast::Namespace,
) -> Option<crate::SharedModule> { ) -> Option<crate::SharedModule> {
assert!(!namespace.is_empty()); debug_assert!(!namespace.is_empty());
let root = namespace.root(); let root = namespace.root();

View File

@ -343,7 +343,7 @@ impl Engine {
// First check hashes // First check hashes
if let Some(case_blocks_list) = cases.get(&hash) { if let Some(case_blocks_list) = cases.get(&hash) {
assert!(!case_blocks_list.is_empty()); debug_assert!(!case_blocks_list.is_empty());
for &index in case_blocks_list { for &index in case_blocks_list {
let block = &expressions[index]; let block = &expressions[index];

View File

@ -363,7 +363,7 @@ impl Engine {
); );
if let Some(FnResolutionCacheEntry { func, source }) = func { if let Some(FnResolutionCacheEntry { func, source }) = func {
assert!(func.is_native()); debug_assert!(func.is_native());
// Push a new call stack frame // Push a new call stack frame
#[cfg(feature = "debugging")] #[cfg(feature = "debugging")]
@ -633,7 +633,7 @@ impl Engine {
.cloned() .cloned()
{ {
// Script function call // Script function call
assert!(func.is_script()); debug_assert!(func.is_script());
let f = func.get_script_fn_def().expect("script-defined function"); let f = func.get_script_fn_def().expect("script-defined function");
let environ = func.get_encapsulated_environ(); let environ = func.get_encapsulated_environ();

View File

@ -932,7 +932,7 @@ pub fn parse_string_literal(
} }
loop { loop {
assert!( debug_assert!(
!verbatim || escape.is_empty(), !verbatim || escape.is_empty(),
"verbatim strings should not have any escapes" "verbatim strings should not have any escapes"
); );