rustfmt 1.72+

This commit is contained in:
Alex Orlenko
2023-08-27 23:26:27 +01:00
parent 53b7b5b70b
commit 6488477bc4
3 changed files with 8 additions and 3 deletions
+4 -2
View File
@@ -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,
}
}
}
+1
View File
@@ -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
View File
@@ -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());