Loads more work on battling, initial stretch to run a turn done.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-06-16 17:59:33 +02:00
parent a33369afcc
commit ff541b0696
50 changed files with 105871 additions and 497 deletions

View File

@@ -249,9 +249,7 @@ impl<T: 'static> Deref for DeferredCleanup<T> {
type Target = T;
fn deref(&self) -> &T {
self.with_value(
|value| unsafe_block!("The borrow of self protects the inner value" => &*value.get()),
)
self.with_value(|value| unsafe_block!("The borrow of self protects the inner value" => &*value.get()))
}
}

View File

@@ -36,10 +36,7 @@ enum Kind {
impl PkmnResult {
pub(super) fn ok() -> Self {
PkmnResult {
kind: Kind::Ok,
id: 0,
}
PkmnResult { kind: Kind::Ok, id: 0 }
}
pub(super) fn argument_null() -> Self {
@@ -65,10 +62,7 @@ impl PkmnResult {
}
pub(super) fn context(self, e: impl Fail) -> Self {
assert!(
self.as_err().is_some(),
"context can only be attached to errors"
);
assert!(self.as_err().is_some(), "context can only be attached to errors");
let err = Some(format_error(&e));
@@ -105,8 +99,7 @@ impl PkmnResult {
.value
}
Err(e) => {
let extract_panic =
|| extract_panic(&e).map(|s| format!("internal panic with '{}'", s));
let extract_panic = || extract_panic(&e).map(|s| format!("internal panic with '{}'", s));
// Set the last error to the panic message if it's not already set
last_result
@@ -124,9 +117,7 @@ impl PkmnResult {
})
}
pub(super) fn with_last_result<R>(
f: impl FnOnce(Option<(PkmnResult, Option<&str>)>) -> R,
) -> R {
pub(super) fn with_last_result<R>(f: impl FnOnce(Option<(PkmnResult, Option<&str>)>) -> R) -> R {
LAST_RESULT.with(|last_result| {
let last_result = last_result.borrow();