mirror of
https://github.com/LemmyNet/lemmy
synced 2024-11-10 06:54:12 +00:00
Remove unnecessary derives
This commit is contained in:
parent
8d1b589d42
commit
4b5b716ea2
7 changed files with 22 additions and 140 deletions
|
@ -13,10 +13,10 @@ use lemmy_api_common::context::LemmyContext;
|
|||
use lemmy_db_schema::{source::community::Community, traits::Crud};
|
||||
use lemmy_utils::{error::LemmyResult, LemmyErrorType};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use strum::{Display, IntoStaticStr};
|
||||
use strum::Display;
|
||||
use url::Url;
|
||||
|
||||
#[derive(Clone, Debug, Display, Deserialize, Serialize, IntoStaticStr)]
|
||||
#[derive(Clone, Debug, Display, Deserialize, Serialize)]
|
||||
pub enum LockType {
|
||||
Lock,
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
use strum::{Display, IntoStaticStr};
|
||||
use strum::Display;
|
||||
|
||||
pub mod block;
|
||||
pub mod community;
|
||||
|
@ -8,7 +8,7 @@ pub mod deletion;
|
|||
pub mod following;
|
||||
pub mod voting;
|
||||
|
||||
#[derive(Clone, Debug, Display, IntoStaticStr, Deserialize, Serialize, PartialEq, Eq)]
|
||||
#[derive(Clone, Debug, Display, Deserialize, Serialize, PartialEq, Eq)]
|
||||
pub enum CreateOrUpdateType {
|
||||
Create,
|
||||
Update,
|
||||
|
|
|
@ -8,7 +8,7 @@ use activitypub_federation::{config::Data, fetch::object_id::ObjectId};
|
|||
use lemmy_api_common::context::LemmyContext;
|
||||
use lemmy_utils::error::{LemmyError, LemmyErrorType, LemmyResult};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use strum::{Display, IntoStaticStr};
|
||||
use strum::Display;
|
||||
use url::Url;
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
|
@ -22,7 +22,7 @@ pub struct Vote {
|
|||
pub(crate) audience: Option<ObjectId<ApubCommunity>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Display, IntoStaticStr, Deserialize, Serialize, PartialEq, Eq)]
|
||||
#[derive(Clone, Debug, Display, Deserialize, Serialize, PartialEq, Eq)]
|
||||
pub enum VoteType {
|
||||
Like,
|
||||
Dislike,
|
||||
|
|
|
@ -48,23 +48,12 @@ pub mod utils;
|
|||
mod schema_setup;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use strum::{Display, EnumString, IntoStaticStr};
|
||||
use strum::{Display, EnumString};
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[derive(
|
||||
EnumString,
|
||||
IntoStaticStr,
|
||||
Display,
|
||||
Debug,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
Clone,
|
||||
Copy,
|
||||
PartialEq,
|
||||
Eq,
|
||||
Default,
|
||||
Hash,
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum, TS))]
|
||||
#[cfg_attr(
|
||||
|
@ -98,19 +87,7 @@ pub enum SortType {
|
|||
Scaled,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
EnumString,
|
||||
Display,
|
||||
IntoStaticStr,
|
||||
Debug,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
Clone,
|
||||
Copy,
|
||||
PartialEq,
|
||||
Eq,
|
||||
Hash,
|
||||
)]
|
||||
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// The comment sort types. See here for descriptions: https://join-lemmy.org/docs/en/users/03-votes-and-ranking.html
|
||||
|
@ -123,18 +100,7 @@ pub enum CommentSortType {
|
|||
}
|
||||
|
||||
#[derive(
|
||||
EnumString,
|
||||
Display,
|
||||
IntoStaticStr,
|
||||
Debug,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
Clone,
|
||||
Copy,
|
||||
PartialEq,
|
||||
Eq,
|
||||
Default,
|
||||
Hash,
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum, TS))]
|
||||
#[cfg_attr(
|
||||
|
@ -157,18 +123,7 @@ pub enum ListingType {
|
|||
}
|
||||
|
||||
#[derive(
|
||||
EnumString,
|
||||
Display,
|
||||
IntoStaticStr,
|
||||
Debug,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
Clone,
|
||||
Copy,
|
||||
PartialEq,
|
||||
Eq,
|
||||
Default,
|
||||
Hash,
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum, TS))]
|
||||
#[cfg_attr(
|
||||
|
@ -189,18 +144,7 @@ pub enum RegistrationMode {
|
|||
}
|
||||
|
||||
#[derive(
|
||||
EnumString,
|
||||
Display,
|
||||
IntoStaticStr,
|
||||
Debug,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
Default,
|
||||
Clone,
|
||||
Copy,
|
||||
PartialEq,
|
||||
Eq,
|
||||
Hash,
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Default, Clone, Copy, PartialEq, Eq, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum, TS))]
|
||||
#[cfg_attr(
|
||||
|
@ -220,19 +164,7 @@ pub enum PostListingMode {
|
|||
SmallCard,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
EnumString,
|
||||
Display,
|
||||
IntoStaticStr,
|
||||
Debug,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
Clone,
|
||||
Copy,
|
||||
PartialEq,
|
||||
Eq,
|
||||
Hash,
|
||||
)]
|
||||
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// The type of content returned from a search.
|
||||
|
@ -245,19 +177,7 @@ pub enum SearchType {
|
|||
Url,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
EnumString,
|
||||
Display,
|
||||
IntoStaticStr,
|
||||
Debug,
|
||||
PartialEq,
|
||||
Eq,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
Clone,
|
||||
Copy,
|
||||
Hash,
|
||||
)]
|
||||
#[derive(EnumString, Display, Debug, PartialEq, Eq, Serialize, Deserialize, Clone, Copy, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// A type / status for a community subscribe.
|
||||
|
@ -267,19 +187,7 @@ pub enum SubscribedType {
|
|||
Pending,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
EnumString,
|
||||
Display,
|
||||
IntoStaticStr,
|
||||
Debug,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
Clone,
|
||||
Copy,
|
||||
PartialEq,
|
||||
Eq,
|
||||
Hash,
|
||||
)]
|
||||
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// A list of possible types for the various modlog actions.
|
||||
|
@ -303,18 +211,7 @@ pub enum ModlogActionType {
|
|||
}
|
||||
|
||||
#[derive(
|
||||
EnumString,
|
||||
Display,
|
||||
IntoStaticStr,
|
||||
Debug,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
Clone,
|
||||
Copy,
|
||||
Default,
|
||||
PartialEq,
|
||||
Eq,
|
||||
Hash,
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
|
@ -328,18 +225,7 @@ pub enum PostFeatureType {
|
|||
}
|
||||
|
||||
#[derive(
|
||||
EnumString,
|
||||
Display,
|
||||
IntoStaticStr,
|
||||
Debug,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
Clone,
|
||||
Copy,
|
||||
PartialEq,
|
||||
Eq,
|
||||
Default,
|
||||
Hash,
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum, TS))]
|
||||
#[cfg_attr(
|
||||
|
|
|
@ -27,7 +27,7 @@ use lemmy_db_schema::{
|
|||
SortType,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use strum::{Display, EnumString, IntoStaticStr};
|
||||
use strum::{Display, EnumString};
|
||||
|
||||
enum ListMode {
|
||||
Admins,
|
||||
|
@ -35,7 +35,7 @@ enum ListMode {
|
|||
Query(PersonQuery),
|
||||
}
|
||||
|
||||
#[derive(EnumString, Display, IntoStaticStr, Debug, Serialize, Deserialize, Clone, Copy)]
|
||||
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy)]
|
||||
/// The person sort types. Converted automatically from `SortType`
|
||||
enum PersonSortType {
|
||||
New,
|
||||
|
|
|
@ -172,11 +172,7 @@ async fn get_feed_data(
|
|||
|
||||
let mut channel = Channel {
|
||||
namespaces: RSS_NAMESPACE.clone(),
|
||||
title: format!(
|
||||
"{} - {}",
|
||||
site_view.site.name,
|
||||
Into::<&'static str>::into(listing_type)
|
||||
),
|
||||
title: format!("{} - {}", site_view.site.name, listing_type),
|
||||
link: context.settings().get_protocol_and_hostname(),
|
||||
items,
|
||||
..Default::default()
|
||||
|
|
|
@ -6,7 +6,7 @@ use std::{
|
|||
net::{IpAddr, Ipv4Addr, Ipv6Addr},
|
||||
time::Instant,
|
||||
};
|
||||
use strum::{Display, IntoStaticStr};
|
||||
use strum::{AsRefStr, Display};
|
||||
use tracing::debug;
|
||||
|
||||
static START_TIME: Lazy<Instant> = Lazy::new(Instant::now);
|
||||
|
@ -66,7 +66,7 @@ impl Bucket {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, enum_map::Enum, Copy, Clone, Display, IntoStaticStr)]
|
||||
#[derive(Debug, enum_map::Enum, Copy, Clone, Display, AsRefStr)]
|
||||
pub enum ActionType {
|
||||
Message,
|
||||
Register,
|
||||
|
|
Loading…
Reference in a new issue