mirror of
https://github.com/mlua-rs/mlua
synced 2026-06-08 16:05:43 +00:00
rustfmt 1.72+
This commit is contained in:
+4
-2
@@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)?;
|
||||
|
||||
+3
-1
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user