From c85d79dd9a2aeb918dd84b823c1a7400b4cebc97 Mon Sep 17 00:00:00 2001 From: syvb Date: Sat, 9 Dec 2023 18:23:49 -0500 Subject: [PATCH] Derive Default impls --- src/entity.rs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/entity.rs b/src/entity.rs index c4a4f21..114858d 100755 --- a/src/entity.rs +++ b/src/entity.rs @@ -40,7 +40,7 @@ pub enum EntityType { } /// Data relating to a claim value. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)] pub enum ClaimValueData { /// The ID of a file on Wikimedia Commons. CommonsMedia(String), @@ -120,35 +120,25 @@ pub enum ClaimValueData { /// A sense ID on Wikidata. Sense(Sid), /// No value. + #[default] NoValue, /// Unknown value. UnknownValue, } -impl Default for ClaimValueData { - fn default() -> Self { - ClaimValueData::NoValue - } -} - /// A statement rank. -#[derive(Debug, Copy, Clone, Eq, PartialEq, PartialOrd, Ord, Serialize, Deserialize)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, PartialOrd, Ord, Default, Serialize, Deserialize)] pub enum Rank { /// The deprecated rank, indicating outdated/wrong info. Deprecated claims should usually be /// ignored. Deprecated, /// Normal rank, the default. + #[default] Normal, /// Preferred rank, indicates the claim is most recent or accurate. Preferred, } -impl Default for Rank { - fn default() -> Self { - Rank::Normal - } -} - impl FromStr for Rank { type Err = EntityError;