From ee6f686cc9aeadc60090dc72a4cbeab6c3156c5a Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Thu, 9 May 2019 13:22:44 -0400 Subject: [PATCH] use `derive` feature over `serde_derive` crate --- Cargo.lock | 4 +++- Cargo.toml | 3 +-- src/config/config_type.rs | 2 ++ src/config/file_lines.rs | 3 +-- src/config/options.rs | 3 ++- src/format-diff/main.rs | 3 +-- src/lib.rs | 2 -- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dd148264be3..b1e1a4b0226 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -798,7 +798,6 @@ dependencies = [ "rustc-ap-syntax_pos 407.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-workspace-hack 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -853,6 +852,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "serde" version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "serde_derive" diff --git a/Cargo.toml b/Cargo.toml index ba888db72ab..4e332ec43b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,8 +37,7 @@ generic-simd = ["bytecount/generic-simd"] atty = "0.2" itertools = "0.8" toml = "0.5" -serde = "1.0" -serde_derive = "1.0" +serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" unicode-segmentation = "1.0.0" regex = "1.0" diff --git a/src/config/config_type.rs b/src/config/config_type.rs index 7c4298dcf1c..82a19c5898f 100644 --- a/src/config/config_type.rs +++ b/src/config/config_type.rs @@ -72,6 +72,8 @@ macro_rules! create_config { use std::collections::HashSet; use std::io::Write; + use serde::{Deserialize, Serialize}; + #[derive(Clone)] pub struct Config { // if a license_template_path has been specified, successfully read, parsed and compiled diff --git a/src/config/file_lines.rs b/src/config/file_lines.rs index 356861282b1..f52f6dab339 100644 --- a/src/config/file_lines.rs +++ b/src/config/file_lines.rs @@ -5,8 +5,7 @@ use std::path::PathBuf; use std::rc::Rc; use std::{cmp, fmt, iter, str}; -use serde::de::{Deserialize, Deserializer}; -use serde::ser::{self, Serialize, Serializer}; +use serde::{ser, Deserialize, Deserializer, Serialize, Serializer}; use serde_json as json; use syntax::source_map::{self, SourceFile}; diff --git a/src/config/options.rs b/src/config/options.rs index 9b0060bfdb6..c927cffba29 100644 --- a/src/config/options.rs +++ b/src/config/options.rs @@ -4,7 +4,8 @@ use std::path::{Path, PathBuf}; use atty; use config_proc_macro::config_type; -use serde::de::{Deserialize, Deserializer, SeqAccess, Visitor}; +use serde::de::{SeqAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; use crate::config::lists::*; use crate::config::Config; diff --git a/src/format-diff/main.rs b/src/format-diff/main.rs index a10a04386aa..bf1bd4add97 100644 --- a/src/format-diff/main.rs +++ b/src/format-diff/main.rs @@ -11,8 +11,7 @@ use getopts; #[macro_use] extern crate log; use regex; -#[macro_use] -extern crate serde_derive; +use serde::{Deserialize, Serialize}; use serde_json as json; use std::collections::HashSet; diff --git a/src/lib.rs b/src/lib.rs index 3de9616a2ce..788fa133546 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,8 +7,6 @@ extern crate derive_new; extern crate lazy_static; #[macro_use] extern crate log; -#[macro_use] -extern crate serde_derive; use std::cell::RefCell; use std::collections::HashMap;