aboutsummaryrefslogtreecommitdiff
path: root/src/raw
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2024-08-26 18:49:17 +0200
committerDaniel Schadt <kingdread@gmx.de>2024-08-26 18:49:17 +0200
commita8e05c660059a19994b46a2949d1c79ca4b4d579 (patch)
tree4c3b5216dcd316c6d084c68637270615e18ea443 /src/raw
parent01e68e3e7b0b5735f8a85a7b547fe14d50e9be7e (diff)
downloadevtclib-a8e05c660059a19994b46a2949d1c79ca4b4d579.tar.gz
evtclib-a8e05c660059a19994b46a2949d1c79ca4b4d579.tar.bz2
evtclib-a8e05c660059a19994b46a2949d1c79ca4b4d579.zip
fix clippy suggestions
Diffstat (limited to 'src/raw')
-rw-r--r--src/raw/types.rs60
1 files changed, 15 insertions, 45 deletions
diff --git a/src/raw/types.rs b/src/raw/types.rs
index ce22f5f..1bc3d08 100644
--- a/src/raw/types.rs
+++ b/src/raw/types.rs
@@ -7,7 +7,7 @@ use std::hash::Hash;
/// The "friend or foe" enum.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
-#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, FromPrimitive)]
+#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash, FromPrimitive)]
pub enum IFF {
/// Green vs green, red vs red.
Friend,
@@ -16,18 +16,13 @@ pub enum IFF {
/// Something very wrong happened.
Unknown,
/// Field is not used in this kind of event.
+ #[default]
None,
}
-impl Default for IFF {
- fn default() -> Self {
- IFF::None
- }
-}
-
/// Combat result (physical)
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
-#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, FromPrimitive)]
+#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash, FromPrimitive)]
pub enum CbtResult {
/// Good physical hit
Normal,
@@ -52,20 +47,16 @@ pub enum CbtResult {
/// Hit was breakbar damage.
Breakbar,
/// Field is not used in this kind of event.
+ #[default]
None,
}
-impl Default for CbtResult {
- fn default() -> Self {
- CbtResult::None
- }
-}
-
/// Combat activation
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
-#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, FromPrimitive)]
+#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash, FromPrimitive)]
pub enum CbtActivation {
/// Field is not used in this kind of event.
+ #[default]
None,
/// Activation without quickness
Normal,
@@ -79,20 +70,15 @@ pub enum CbtActivation {
Reset,
}
-impl Default for CbtActivation {
- fn default() -> Self {
- CbtActivation::None
- }
-}
-
/// Combat state change
///
/// The referenced fields are of the [`CbtEvent`](struct.CbtEvent.html)
/// struct.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
-#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, FromPrimitive)]
+#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash, FromPrimitive)]
pub enum CbtStateChange {
/// Field is not used in this kind of event.
+ #[default]
None,
/// `src_agent` entered combat.
///
@@ -213,17 +199,12 @@ pub enum CbtStateChange {
BarrierUpdate,
}
-impl Default for CbtStateChange {
- fn default() -> Self {
- CbtStateChange::None
- }
-}
-
/// Combat buff remove type
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
-#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, FromPrimitive)]
+#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash, FromPrimitive)]
pub enum CbtBuffRemove {
/// Field is not used in this kind of event.
+ #[default]
None,
/// All stacks removed.
All,
@@ -237,12 +218,6 @@ pub enum CbtBuffRemove {
Manual,
}
-impl Default for CbtBuffRemove {
- fn default() -> Self {
- CbtBuffRemove::None
- }
-}
-
/// Custom skill ids
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, FromPrimitive)]
@@ -257,9 +232,10 @@ pub enum CbtCustomSkill {
/// Language
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
-#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, FromPrimitive)]
+#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash, FromPrimitive)]
pub enum Language {
/// English.
+ #[default]
Eng = 0,
/// French.
Fre = 2,
@@ -269,12 +245,6 @@ pub enum Language {
Spa = 4,
}
-impl Default for Language {
- fn default() -> Self {
- Language::Eng
- }
-}
-
/// Buff formula attributes.
///
/// Variants prefixed with `Custom` are not native to the game client but rather variants added by
@@ -402,7 +372,7 @@ impl Agent {
/// Gadgets are entities spawned by some skills, like the "Binding Roots"
/// spawned by Entangle.
pub fn is_gadget(&self) -> bool {
- self.is_elite == std::u32::MAX && (self.prof & 0xffff_0000) == 0xffff_0000
+ self.is_elite == u32::MAX && (self.prof & 0xffff_0000) == 0xffff_0000
}
/// Checks whether this agent is a character.
@@ -410,12 +380,12 @@ impl Agent {
/// Characters are entities like clones, pets, minions, spirits, but also
/// minis.
pub fn is_character(&self) -> bool {
- self.is_elite == std::u32::MAX && (self.prof & 0xffff_0000) != 0xffff_0000
+ self.is_elite == u32::MAX && (self.prof & 0xffff_0000) != 0xffff_0000
}
/// Checks whether this agent is a player.
pub fn is_player(&self) -> bool {
- self.is_elite != std::u32::MAX
+ self.is_elite != u32::MAX
}
}