Merge pull request #1798 from klensy/serde_derive

Use serde's `derive` feature instead of directly importing serde_derive
This commit is contained in:
Eric Huss 2022-05-05 12:55:01 -07:00 committed by GitHub
commit a462fb63c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 13 additions and 5 deletions

4
Cargo.lock generated
View File

@ -865,7 +865,6 @@ dependencies = [
"select",
"semver",
"serde",
"serde_derive",
"serde_json",
"shlex",
"tempfile",
@ -1483,6 +1482,9 @@ name = "serde"
version = "1.0.129"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d1f72836d2aa753853178eda473a3b9d8e4eefdaf20523b919677e6de489f8f1"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"

View File

@ -28,8 +28,7 @@ memchr = "2.0"
opener = "0.5"
pulldown-cmark = { version = "0.9.1", default-features = false }
regex = "1.5.5"
serde = "1.0"
serde_derive = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
shlex = "1"
tempfile = "3.0"

View File

@ -9,6 +9,8 @@ use crate::config::BuildConfig;
use crate::errors::*;
use crate::utils::bracket_escape;
use serde::{Deserialize, Serialize};
/// Load a book into memory from its `src/` directory.
pub fn load_book<P: AsRef<Path>>(src_dir: P, cfg: &BuildConfig) -> Result<Book> {
let src_dir = src_dir.as_ref();

View File

@ -1,6 +1,7 @@
use crate::errors::*;
use memchr::{self, Memchr};
use pulldown_cmark::{self, Event, HeadingLevel, Tag};
use serde::{Deserialize, Serialize};
use std::fmt::{self, Display, Formatter};
use std::iter::FromIterator;
use std::ops::{Deref, DerefMut};

View File

@ -89,8 +89,6 @@ extern crate lazy_static;
#[macro_use]
extern crate log;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate serde_json;
#[cfg(test)]

View File

@ -16,6 +16,8 @@ use std::cell::RefCell;
use std::collections::HashMap;
use std::path::PathBuf;
use serde::{Deserialize, Serialize};
/// Extra information for a `Preprocessor` to give them more context when
/// processing a book.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]

View File

@ -11,6 +11,8 @@ use crate::errors::*;
use crate::theme::searcher;
use crate::utils;
use serde::Serialize;
/// Creates all files required for search.
pub fn create_files(search_config: &Search, destination: &Path, book: &Book) -> Result<()> {
let mut index = Index::new(&["title", "body", "breadcrumbs"]);

View File

@ -29,6 +29,8 @@ use crate::config::Config;
use crate::errors::*;
use toml::Value;
use serde::{Deserialize, Serialize};
/// An arbitrary `mdbook` backend.
///
/// Although it's quite possible for you to import `mdbook` as a library and