From 11781f0c1b6248c7680dccfdf6c61eabe43236b9 Mon Sep 17 00:00:00 2001 From: Fauconfan Date: Sat, 9 Jul 2022 15:05:06 +0200 Subject: [PATCH] remove __non_exhaustive members, add non_exhaustive attribute instead --- src/book/book.rs | 7 ++----- src/preprocess/mod.rs | 4 +--- src/renderer/mod.rs | 4 +--- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/book/book.rs b/src/book/book.rs index d28c22da..34c42fa5 100644 --- a/src/book/book.rs +++ b/src/book/book.rs @@ -77,10 +77,10 @@ fn create_missing(src_dir: &Path, summary: &Summary) -> Result<()> { /// [`iter()`]: #method.iter /// [`for_each_mut()`]: #method.for_each_mut #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct Book { /// The sections in this book. pub sections: Vec, - __non_exhaustive: (), } impl Book { @@ -228,10 +228,7 @@ pub(crate) fn load_book_from_disk>(summary: &Summary, src_dir: P) chapters.push(chapter); } - Ok(Book { - sections: chapters, - __non_exhaustive: (), - }) + Ok(Book { sections: chapters }) } fn load_summary_item + Clone>( diff --git a/src/preprocess/mod.rs b/src/preprocess/mod.rs index 894e2003..60100cac 100644 --- a/src/preprocess/mod.rs +++ b/src/preprocess/mod.rs @@ -21,6 +21,7 @@ use serde::{Deserialize, Serialize}; /// Extra information for a `Preprocessor` to give them more context when /// processing a book. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct PreprocessorContext { /// The location of the book directory on disk. pub root: PathBuf, @@ -32,8 +33,6 @@ pub struct PreprocessorContext { pub mdbook_version: String, #[serde(skip)] pub(crate) chapter_titles: RefCell>, - #[serde(skip)] - __non_exhaustive: (), } impl PreprocessorContext { @@ -45,7 +44,6 @@ impl PreprocessorContext { renderer, mdbook_version: crate::MDBOOK_VERSION.to_string(), chapter_titles: RefCell::new(HashMap::new()), - __non_exhaustive: (), } } } diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index 15465fbc..c7ff0215 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -51,6 +51,7 @@ pub trait Renderer { /// The context provided to all renderers. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct RenderContext { /// Which version of `mdbook` did this come from (as written in `mdbook`'s /// `Cargo.toml`). Useful if you know the renderer is only compatible with @@ -68,8 +69,6 @@ pub struct RenderContext { pub destination: PathBuf, #[serde(skip)] pub(crate) chapter_titles: HashMap, - #[serde(skip)] - __non_exhaustive: (), } impl RenderContext { @@ -86,7 +85,6 @@ impl RenderContext { root: root.into(), destination: destination.into(), chapter_titles: HashMap::new(), - __non_exhaustive: (), } }