Clippy fixes and documentation
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-06-24 15:05:58 +02:00
parent 78bb91093b
commit 3400d9ec1e
12 changed files with 61 additions and 4 deletions

View File

@@ -56,6 +56,9 @@ pub trait Form: Debug {
/// Arbitrary flags that can be applied to the move.
fn has_flag_by_hash(&self, key_hash: u32) -> bool;
/// Check if two forms are equal.
fn eq(&self, other: &dyn Form) -> bool;
}
/// A form is a variant of a specific species. A species always has at least one form, but can have
@@ -217,6 +220,10 @@ impl Form for FormImpl {
fn has_flag_by_hash(&self, key_hash: u32) -> bool {
self.flags.contains::<u32>(&key_hash)
}
fn eq(&self, other: &dyn Form) -> bool {
std::ptr::eq(self, other as *const dyn Form as *const Self)
}
}
#[cfg(test)]
@@ -247,6 +254,7 @@ pub(crate) mod tests {
fn get_random_hidden_ability<'a>(&'a self, rand: &mut Random) -> Result<&'a StringKey>;
fn has_flag(&self, key: &StringKey) -> bool;
fn has_flag_by_hash(&self, key_hash: u32) -> bool;
fn eq(&self, other: &dyn Form) -> bool;
}
}
}