diff --git a/Cargo.lock b/Cargo.lock index 949186b..f04e516 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2485,7 +2485,6 @@ dependencies = [ "rocket_contrib", "rust-argon2", "serde", - "serde_derive", "serde_json", "sqlx", "strum", diff --git a/Cargo.toml b/Cargo.toml index 9cbcc16..d9bacc6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,8 +24,7 @@ tonic-build = "0.3" [dependencies] tonic = "0.3" prost = "0.6" -serde = "1.0" -serde_derive = "1.0" +serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" erased-serde = "0.3" thiserror = "1.0" diff --git a/build.rs b/build.rs index 12c2ab5..28ade65 100644 --- a/build.rs +++ b/build.rs @@ -37,7 +37,7 @@ fn main() { let mut config = prost_build::Config::new(); config.btree_map(&["."]); - config.type_attribute(".", "#[derive(Serialize)]"); + config.type_attribute(".", "#[derive(::serde::Serialize)]"); config.type_attribute(".", "#[serde(rename_all = \"camelCase\")]"); tonic_build::configure() diff --git a/src/main.rs b/src/main.rs index 9549ffc..6178168 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,11 +4,6 @@ extern crate rocket; #[macro_use] extern crate rocket_contrib; -// Seemingly necessary to get serde::Serialize into scope for Prost -// code generation. -#[macro_use] -extern crate serde_derive; - use log::{error, info}; use rocket_contrib::serve::StaticFiles; use rocket_contrib::templates::Template; diff --git a/src/models/characters.rs b/src/models/characters.rs index f75476e..8b4e330 100644 --- a/src/models/characters.rs +++ b/src/models/characters.rs @@ -2,7 +2,7 @@ use crate::errors::Error; use crate::models::proto::cofd::*; use crate::models::users::User; use prost::bytes::BytesMut; -use serde_derive::Serialize; +use serde::Serialize; use strum::{EnumIter, EnumString}; /// Dynamic character data is an opaque container type that holds diff --git a/src/models/convert.rs b/src/models/convert.rs index ca34ad4..6b6a3ee 100644 --- a/src/models/convert.rs +++ b/src/models/convert.rs @@ -1,6 +1,7 @@ use super::characters::CharacterDataType; use rocket::http::RawStr; use rocket::request::FromFormValue; +use serde::Serialize; use std::str::FromStr; use thiserror::Error; diff --git a/src/models/users.rs b/src/models/users.rs index 96278b1..9dad614 100644 --- a/src/models/users.rs +++ b/src/models/users.rs @@ -3,7 +3,7 @@ use argon2::{self, Config, Error as ArgonError}; use rand::Rng; use rocket::outcome::IntoOutcome; use rocket::request::{self, FromRequest, Request}; -use serde_derive::Serialize; +use serde::Serialize; pub(crate) fn hash_password(raw_password: &str) -> Result { let salt = rand::thread_rng().gen::<[u8; 16]>(); diff --git a/src/routes/characters.rs b/src/routes/characters.rs index 53ceb32..620ba03 100644 --- a/src/routes/characters.rs +++ b/src/routes/characters.rs @@ -3,6 +3,7 @@ use crate::errors::Error; use crate::models::characters::{Character, CharacterDataType, DynCharacterData, Visibility}; use crate::models::users::User; use rocket_contrib::templates::Template; +use serde::Serialize; mod edit; mod new; diff --git a/src/routes/characters/new.rs b/src/routes/characters/new.rs index 49bb788..9609155 100644 --- a/src/routes/characters/new.rs +++ b/src/routes/characters/new.rs @@ -7,6 +7,7 @@ use crate::models::{ }; use rocket::{request::Form, response::Redirect}; use rocket_contrib::templates::Template; +use serde::Serialize; use strum::IntoEnumIterator; /// Form submission for creating a new character. diff --git a/src/routes/root.rs b/src/routes/root.rs index b2cf619..1be77ca 100644 --- a/src/routes/root.rs +++ b/src/routes/root.rs @@ -4,7 +4,7 @@ use crate::models::characters::Visibility; use crate::models::{characters::StrippedCharacter, users::User}; use rocket::response::Redirect; use rocket_contrib::templates::Template; -use serde_derive::Serialize; +use serde::Serialize; pub fn routes() -> Vec { routes![index, user_index, proto_test]