diff options
-rw-r--r-- | src/hook.rs | 6 | ||||
-rw-r--r-- | src/scope.rs | 1 | ||||
-rw-r--r-- | tests/error.rs | 4 |
3 files changed, 8 insertions, 3 deletions
diff --git a/src/hook.rs b/src/hook.rs index 443facd..950bc79 100644 --- a/src/hook.rs +++ b/src/hook.rs @@ -353,8 +353,10 @@ impl HookTriggers { // Returns the `count` parameter to pass to `lua_sethook`, if applicable. Otherwise, zero is // returned. pub(crate) const fn count(&self) -> c_int { - let Some(n) = self.every_nth_instruction else { return 0 }; - n as c_int + match self.every_nth_instruction { + Some(n) => n as c_int, + None => 0, + } } } diff --git a/src/scope.rs b/src/scope.rs index 271e742..9874fd9 100644 --- a/src/scope.rs +++ b/src/scope.rs @@ -434,6 +434,7 @@ impl<'lua, 'scope> Scope<'lua, 'scope> { push_table(state, 0, fields_nrec, true)?; } for (k, f) in registry.fields { + #[rustfmt::skip] let NonStaticMethod::Function(f) = f else { unreachable!() }; mlua_assert!(f(lua, 0)? == 1, "field function must return one value"); rawset_field(state, -2, &k)?; diff --git a/tests/error.rs b/tests/error.rs index c0650a7..0bd224a 100644 --- a/tests/error.rs +++ b/tests/error.rs @@ -41,7 +41,9 @@ fn test_error_context() -> Result<()> { .context("some new context") })?; let res = func3.call::<_, ()>(()).err().unwrap(); - let Error::CallbackError { cause, .. } = &res else { unreachable!() }; + let Error::CallbackError { cause, .. } = &res else { + unreachable!() + }; assert!(!res.to_string().contains("some context")); assert!(res.to_string().contains("some new context")); assert!(cause.downcast_ref::<io::Error>().is_some()); |