Remove some unused #[derive] (#473)

We used to need them, probably when we were using Tera.
This commit is contained in:
Baptiste Gelez 2019-03-12 19:40:54 +01:00 committed by GitHub
parent 6405bd7261
commit 42dca3daae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 23 additions and 37 deletions

2
Cargo.lock generated
View File

@ -1810,7 +1810,6 @@ dependencies = [
"ructe 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "ructe 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
"scheduled-thread-pool 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "scheduled-thread-pool 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_qs 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde_qs 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"validator 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "validator 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1892,7 +1891,6 @@ dependencies = [
"rocket 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rocket 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"scheduled-thread-pool 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "scheduled-thread-pool 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)",
"tantivy 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "tantivy 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -26,7 +26,6 @@ rocket_i18n = "0.4.0"
rpassword = "2.0" rpassword = "2.0"
scheduled-thread-pool = "0.2.0" scheduled-thread-pool = "0.2.0"
serde = "1.0" serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0" serde_json = "1.0"
serde_qs = "0.4" serde_qs = "0.4"
validator = "0.8" validator = "0.8"

View File

@ -1,4 +1,4 @@
use activitypub::{Activity, Actor, Link, Object}; use activitypub::{Activity, Link, Object};
use array_tool::vec::Uniq; use array_tool::vec::Uniq;
use reqwest::Client; use reqwest::Client;
use rocket::{ use rocket::{
@ -106,7 +106,7 @@ impl<'a, 'r> FromRequest<'a, 'r> for ApRequest {
.unwrap_or(Outcome::Forward(())) .unwrap_or(Outcome::Forward(()))
} }
} }
pub fn broadcast<S: sign::Signer, A: Activity, T: inbox::WithInbox + Actor>( pub fn broadcast<S: sign::Signer, A: Activity, T: inbox::WithInbox>(
sender: &S, sender: &S,
act: A, act: A,
to: Vec<T>, to: Vec<T>,

View File

@ -18,7 +18,6 @@ rocket = "0.4.0"
reqwest = "0.9" reqwest = "0.9"
scheduled-thread-pool = "0.2.0" scheduled-thread-pool = "0.2.0"
serde = "1.0" serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0" serde_json = "1.0"
tantivy = "0.8.2" tantivy = "0.8.2"
url = "1.7" url = "1.7"

View File

@ -1,4 +1,4 @@
use activitypub::{actor::Group, collection::OrderedCollection, Actor, CustomObject, Object}; use activitypub::{actor::Group, collection::OrderedCollection, CustomObject};
use chrono::NaiveDateTime; use chrono::NaiveDateTime;
use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl, SaveChangesDsl}; use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl, SaveChangesDsl};
use openssl::{ use openssl::{
@ -30,7 +30,7 @@ use {Connection, BASE_URL, USE_HTTPS, Error, Result};
pub type CustomGroup = CustomObject<ApSignature, Group>; pub type CustomGroup = CustomObject<ApSignature, Group>;
#[derive(Queryable, Identifiable, Serialize, Deserialize, Clone, AsChangeset)] #[derive(Queryable, Identifiable, Clone, AsChangeset)]
pub struct Blog { pub struct Blog {
pub id: i32, pub id: i32,
pub actor_id: String, pub actor_id: String,
@ -363,9 +363,6 @@ impl IntoId for Blog {
} }
} }
impl Object for Blog {}
impl Actor for Blog {}
impl WithInbox for Blog { impl WithInbox for Blog {
fn get_inbox_url(&self) -> String { fn get_inbox_url(&self) -> String {
self.inbox_url.clone() self.inbox_url.clone()

View File

@ -5,7 +5,7 @@ use schema::comment_seers;
use users::User; use users::User;
use {Connection, Error, Result}; use {Connection, Error, Result};
#[derive(Queryable, Serialize, Clone)] #[derive(Queryable, Clone)]
pub struct CommentSeers { pub struct CommentSeers {
pub id: i32, pub id: i32,
pub comment_id: i32, pub comment_id: i32,

View File

@ -20,7 +20,7 @@ use schema::comments;
use users::User; use users::User;
use {Connection, Error, Result}; use {Connection, Error, Result};
#[derive(Queryable, Identifiable, Serialize, Clone, AsChangeset)] #[derive(Queryable, Identifiable, Clone, AsChangeset)]
pub struct Comment { pub struct Comment {
pub id: i32, pub id: i32,
pub content: SafeString, pub content: SafeString,

View File

@ -1,7 +1,6 @@
use activitypub::{ use activitypub::{
activity::{Accept, Follow as FollowAct, Undo}, activity::{Accept, Follow as FollowAct, Undo},
actor::Person, actor::Person,
Actor,
}; };
use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl, SaveChangesDsl}; use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl, SaveChangesDsl};
@ -74,7 +73,7 @@ impl Follow {
/// from -> The one sending the follow request /// from -> The one sending the follow request
/// target -> The target of the request, responding with Accept /// target -> The target of the request, responding with Accept
pub fn accept_follow<A: Signer + IntoId + Clone, B: Clone + WithInbox + Actor + IntoId>( pub fn accept_follow<A: Signer + IntoId + Clone, B: Clone + WithInbox + IntoId>(
conn: &Connection, conn: &Connection,
from: &B, from: &B,
target: &A, target: &A,

View File

@ -9,7 +9,7 @@ use schema::{instances, users};
use users::User; use users::User;
use {Connection, Error, Result}; use {Connection, Error, Result};
#[derive(Clone, Identifiable, Queryable, Serialize)] #[derive(Clone, Identifiable, Queryable)]
pub struct Instance { pub struct Instance {
pub id: i32, pub id: i32,
pub public_domain: String, pub public_domain: String,

View File

@ -21,8 +21,6 @@ extern crate rocket;
extern crate scheduled_thread_pool; extern crate scheduled_thread_pool;
extern crate serde; extern crate serde;
#[macro_use] #[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate serde_json; extern crate serde_json;
#[macro_use] #[macro_use]
extern crate tantivy; extern crate tantivy;

View File

@ -13,7 +13,7 @@ use schema::medias;
use users::User; use users::User;
use {ap_url, Connection, Error, Result}; use {ap_url, Connection, Error, Result};
#[derive(Clone, Identifiable, Queryable, Serialize)] #[derive(Clone, Identifiable, Queryable)]
pub struct Media { pub struct Media {
pub id: i32, pub id: i32,
pub file_path: String, pub file_path: String,

View File

@ -9,7 +9,7 @@ use schema::mentions;
use users::User; use users::User;
use {Connection, Error, Result}; use {Connection, Error, Result};
#[derive(Clone, Queryable, Identifiable, Serialize, Deserialize)] #[derive(Clone, Queryable, Identifiable)]
pub struct Mention { pub struct Mention {
pub id: i32, pub id: i32,
pub mentioned_id: i32, pub mentioned_id: i32,

View File

@ -19,7 +19,7 @@ pub mod notification_kind {
pub const RESHARE: &str = "RESHARE"; pub const RESHARE: &str = "RESHARE";
} }
#[derive(Clone, Queryable, Identifiable, Serialize)] #[derive(Clone, Queryable, Identifiable)]
pub struct Notification { pub struct Notification {
pub id: i32, pub id: i32,
pub user_id: i32, pub user_id: i32,

View File

@ -34,7 +34,7 @@ use {ap_url, Connection, BASE_URL, Error, Result, ApiResult};
pub type LicensedArticle = CustomObject<Licensed, Article>; pub type LicensedArticle = CustomObject<Licensed, Article>;
#[derive(Queryable, Identifiable, Serialize, Clone, AsChangeset)] #[derive(Queryable, Identifiable, Clone, AsChangeset)]
#[changeset_options(treat_none_as_null = "true")] #[changeset_options(treat_none_as_null = "true")]
pub struct Post { pub struct Post {
pub id: i32, pub id: i32,

View File

@ -12,7 +12,7 @@ use schema::reshares;
use users::User; use users::User;
use {Connection, Error, Result}; use {Connection, Error, Result};
#[derive(Clone, Serialize, Deserialize, Queryable, Identifiable)] #[derive(Clone, Queryable, Identifiable)]
pub struct Reshare { pub struct Reshare {
pub id: i32, pub id: i32,
pub user_id: i32, pub user_id: i32,

View File

@ -5,7 +5,7 @@ use plume_common::activity_pub::Hashtag;
use schema::tags; use schema::tags;
use {ap_url, Connection, Error, Result}; use {ap_url, Connection, Error, Result};
#[derive(Clone, Identifiable, Serialize, Queryable)] #[derive(Clone, Identifiable, Queryable)]
pub struct Tag { pub struct Tag {
pub id: i32, pub id: i32,
pub tag: String, pub tag: String,

View File

@ -1,6 +1,6 @@
use activitypub::{ use activitypub::{
actor::Person, collection::OrderedCollection, object::Image, Activity, Actor, CustomObject, actor::Person, collection::OrderedCollection, object::Image, Activity, CustomObject,
Endpoint, Object, Endpoint,
}; };
use bcrypt; use bcrypt;
use chrono::{NaiveDateTime, Utc}; use chrono::{NaiveDateTime, Utc};
@ -44,7 +44,7 @@ use {ap_url, Connection, BASE_URL, USE_HTTPS, Error, Result};
pub type CustomPerson = CustomObject<ApSignature, Person>; pub type CustomPerson = CustomObject<ApSignature, Person>;
#[derive(Queryable, Identifiable, Serialize, Deserialize, Clone, Debug, AsChangeset)] #[derive(Queryable, Identifiable, Clone, Debug, AsChangeset)]
pub struct User { pub struct User {
pub id: i32, pub id: i32,
pub username: String, pub username: String,
@ -829,8 +829,6 @@ impl IntoId for User {
} }
impl Eq for User {} impl Eq for User {}
impl Object for User {}
impl Actor for User {}
impl WithInbox for User { impl WithInbox for User {
fn get_inbox_url(&self) -> String { fn get_inbox_url(&self) -> String {

View File

@ -30,8 +30,6 @@ extern crate rocket_i18n;
extern crate scheduled_thread_pool; extern crate scheduled_thread_pool;
extern crate serde; extern crate serde;
#[macro_use] #[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate serde_json; extern crate serde_json;
extern crate serde_qs; extern crate serde_qs;
extern crate validator; extern crate validator;

View File

@ -66,7 +66,7 @@ pub fn new_auth(i18n: I18n) -> Flash<Redirect>{
) )
} }
#[derive(Default, FromForm, Validate, Serialize)] #[derive(Default, FromForm, Validate)]
pub struct NewBlogForm { pub struct NewBlogForm {
#[validate(custom(function = "valid_slug", message = "Invalid name"))] #[validate(custom(function = "valid_slug", message = "Invalid name"))]
pub title: String, pub title: String,

View File

@ -25,7 +25,7 @@ use plume_models::{
use Worker; use Worker;
use routes::errors::ErrorPage; use routes::errors::ErrorPage;
#[derive(Default, FromForm, Debug, Validate, Serialize)] #[derive(Default, FromForm, Debug, Validate)]
pub struct NewCommentForm { pub struct NewCommentForm {
pub responding_to: Option<i32>, pub responding_to: Option<i32>,
#[validate(length(min = "1", message = "Your comment can't be empty"))] #[validate(length(min = "1", message = "Your comment can't be empty"))]

View File

@ -103,7 +103,7 @@ pub fn admin(conn: DbConn, admin: Admin, intl: I18n) -> Result<Ructe, ErrorPage>
))) )))
} }
#[derive(Clone, FromForm, Validate, Serialize)] #[derive(Clone, FromForm, Validate)]
pub struct InstanceSettingsForm { pub struct InstanceSettingsForm {
#[validate(length(min = "1"))] #[validate(length(min = "1"))]
pub name: String, pub name: String,

View File

@ -272,7 +272,7 @@ pub fn update(blog: String, slug: String, user: User, cl: ContentLen, form: Leni
} }
} }
#[derive(Default, FromForm, Validate, Serialize)] #[derive(Default, FromForm, Validate)]
pub struct NewPostForm { pub struct NewPostForm {
#[validate(custom(function = "valid_slug", message = "Invalid title"))] #[validate(custom(function = "valid_slug", message = "Invalid title"))]
pub title: String, pub title: String,

View File

@ -29,7 +29,7 @@ pub fn new(user: Option<User>, conn: DbConn, m: Option<String>, intl: I18n) -> R
)) ))
} }
#[derive(Default, FromForm, Validate, Serialize)] #[derive(Default, FromForm, Validate)]
pub struct LoginForm { pub struct LoginForm {
#[validate(length(min = "1", message = "We need an email or a username to identify you"))] #[validate(length(min = "1", message = "We need an email or a username to identify you"))]
pub email_or_name: String, pub email_or_name: String,

View File

@ -276,7 +276,7 @@ pub fn delete(name: String, conn: DbConn, user: User, mut cookies: Cookies, sear
} }
} }
#[derive(Default, FromForm, Serialize, Validate)] #[derive(Default, FromForm, Validate)]
#[validate( #[validate(
schema( schema(
function = "passwords_match", function = "passwords_match",