refactor(report): Switch to swrde derive feature

This commit is contained in:
Ed Page 2019-08-07 08:16:22 -05:00
parent 3419a8df85
commit a129fb3d65
4 changed files with 8 additions and 10 deletions

4
Cargo.lock generated
View file

@ -651,6 +651,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "serde" name = "serde"
version = "1.0.85" version = "1.0.85"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
@ -807,7 +810,6 @@ dependencies = [
"phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)",
"structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -28,8 +28,7 @@ ignore = "0.4"
phf = { version = "0.7", features = ["unicase"] } phf = { version = "0.7", features = ["unicase"] }
regex = "1.0" regex = "1.0"
lazy_static = "1.2.0" lazy_static = "1.2.0"
serde = "1.0" serde = { version = "1.0", features = ["derive"] }
serde_derive = "1.0"
serde_json = "1.0" serde_json = "1.0"
itertools = "0.8" itertools = "0.8"
unicase = "1.1" unicase = "1.1"

View file

@ -1,6 +1,3 @@
#[macro_use]
extern crate serde_derive;
mod dict; mod dict;
mod dict_codegen; mod dict_codegen;

View file

@ -1,7 +1,7 @@
use std::borrow::Cow; use std::borrow::Cow;
use std::io::{self, Write}; use std::io::{self, Write};
#[derive(Clone, Debug, Serialize)] #[derive(Clone, Debug, serde::Serialize)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
#[serde(tag = "type")] #[serde(tag = "type")]
pub enum Message<'m> { pub enum Message<'m> {
@ -28,14 +28,14 @@ impl<'m> From<FilenameCorrection<'m>> for Message<'m> {
} }
} }
#[derive(Clone, Debug, Serialize)] #[derive(Clone, Debug, serde::Serialize)]
pub struct BinaryFile<'m> { pub struct BinaryFile<'m> {
pub path: &'m std::path::Path, pub path: &'m std::path::Path,
#[serde(skip)] #[serde(skip)]
pub(crate) non_exhaustive: (), pub(crate) non_exhaustive: (),
} }
#[derive(Clone, Debug, Serialize)] #[derive(Clone, Debug, serde::Serialize)]
pub struct Correction<'m> { pub struct Correction<'m> {
pub path: &'m std::path::Path, pub path: &'m std::path::Path,
#[serde(skip)] #[serde(skip)]
@ -48,7 +48,7 @@ pub struct Correction<'m> {
pub(crate) non_exhaustive: (), pub(crate) non_exhaustive: (),
} }
#[derive(Clone, Debug, Serialize)] #[derive(Clone, Debug, serde::Serialize)]
pub struct FilenameCorrection<'m> { pub struct FilenameCorrection<'m> {
pub path: &'m std::path::Path, pub path: &'m std::path::Path,
pub typo: &'m str, pub typo: &'m str,