Remove extern crate for serde serialize

This commit is contained in:
jeff 2021-01-15 20:32:09 +00:00
parent 92c402e254
commit 2738de85db
10 changed files with 8 additions and 12 deletions

1
Cargo.lock generated
View File

@ -2485,7 +2485,6 @@ dependencies = [
"rocket_contrib", "rocket_contrib",
"rust-argon2", "rust-argon2",
"serde", "serde",
"serde_derive",
"serde_json", "serde_json",
"sqlx", "sqlx",
"strum", "strum",

View File

@ -24,8 +24,7 @@ tonic-build = "0.3"
[dependencies] [dependencies]
tonic = "0.3" tonic = "0.3"
prost = "0.6" prost = "0.6"
serde = "1.0" serde = { version = "1.0", features = ["derive"] }
serde_derive = "1.0"
serde_json = "1.0" serde_json = "1.0"
erased-serde = "0.3" erased-serde = "0.3"
thiserror = "1.0" thiserror = "1.0"

View File

@ -37,7 +37,7 @@ fn main() {
let mut config = prost_build::Config::new(); let mut config = prost_build::Config::new();
config.btree_map(&["."]); config.btree_map(&["."]);
config.type_attribute(".", "#[derive(Serialize)]"); config.type_attribute(".", "#[derive(::serde::Serialize)]");
config.type_attribute(".", "#[serde(rename_all = \"camelCase\")]"); config.type_attribute(".", "#[serde(rename_all = \"camelCase\")]");
tonic_build::configure() tonic_build::configure()

View File

@ -4,11 +4,6 @@ extern crate rocket;
#[macro_use] #[macro_use]
extern crate rocket_contrib; 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 log::{error, info};
use rocket_contrib::serve::StaticFiles; use rocket_contrib::serve::StaticFiles;
use rocket_contrib::templates::Template; use rocket_contrib::templates::Template;

View File

@ -2,7 +2,7 @@ use crate::errors::Error;
use crate::models::proto::cofd::*; use crate::models::proto::cofd::*;
use crate::models::users::User; use crate::models::users::User;
use prost::bytes::BytesMut; use prost::bytes::BytesMut;
use serde_derive::Serialize; use serde::Serialize;
use strum::{EnumIter, EnumString}; use strum::{EnumIter, EnumString};
/// Dynamic character data is an opaque container type that holds /// Dynamic character data is an opaque container type that holds

View File

@ -1,6 +1,7 @@
use super::characters::CharacterDataType; use super::characters::CharacterDataType;
use rocket::http::RawStr; use rocket::http::RawStr;
use rocket::request::FromFormValue; use rocket::request::FromFormValue;
use serde::Serialize;
use std::str::FromStr; use std::str::FromStr;
use thiserror::Error; use thiserror::Error;

View File

@ -3,7 +3,7 @@ use argon2::{self, Config, Error as ArgonError};
use rand::Rng; use rand::Rng;
use rocket::outcome::IntoOutcome; use rocket::outcome::IntoOutcome;
use rocket::request::{self, FromRequest, Request}; use rocket::request::{self, FromRequest, Request};
use serde_derive::Serialize; use serde::Serialize;
pub(crate) fn hash_password(raw_password: &str) -> Result<String, ArgonError> { pub(crate) fn hash_password(raw_password: &str) -> Result<String, ArgonError> {
let salt = rand::thread_rng().gen::<[u8; 16]>(); let salt = rand::thread_rng().gen::<[u8; 16]>();

View File

@ -3,6 +3,7 @@ use crate::errors::Error;
use crate::models::characters::{Character, CharacterDataType, DynCharacterData, Visibility}; use crate::models::characters::{Character, CharacterDataType, DynCharacterData, Visibility};
use crate::models::users::User; use crate::models::users::User;
use rocket_contrib::templates::Template; use rocket_contrib::templates::Template;
use serde::Serialize;
mod edit; mod edit;
mod new; mod new;

View File

@ -7,6 +7,7 @@ use crate::models::{
}; };
use rocket::{request::Form, response::Redirect}; use rocket::{request::Form, response::Redirect};
use rocket_contrib::templates::Template; use rocket_contrib::templates::Template;
use serde::Serialize;
use strum::IntoEnumIterator; use strum::IntoEnumIterator;
/// Form submission for creating a new character. /// Form submission for creating a new character.

View File

@ -4,7 +4,7 @@ use crate::models::characters::Visibility;
use crate::models::{characters::StrippedCharacter, users::User}; use crate::models::{characters::StrippedCharacter, users::User};
use rocket::response::Redirect; use rocket::response::Redirect;
use rocket_contrib::templates::Template; use rocket_contrib::templates::Template;
use serde_derive::Serialize; use serde::Serialize;
pub fn routes() -> Vec<rocket::Route> { pub fn routes() -> Vec<rocket::Route> {
routes![index, user_index, proto_test] routes![index, user_index, proto_test]