Skip to content

Commit 01313a3

Browse files
authored
Merge pull request #1851 from FauconFan/revert-1848-remove_non_exhaustive
Revert "remove __non_exhaustive members, add non_exhaustive attribute instead"
2 parents 42d6fd5 + f92911b commit 01313a3

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/book/book.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ fn create_missing(src_dir: &Path, summary: &Summary) -> Result<()> {
7777
/// [`iter()`]: #method.iter
7878
/// [`for_each_mut()`]: #method.for_each_mut
7979
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
80-
#[non_exhaustive]
8180
pub struct Book {
8281
/// The sections in this book.
8382
pub sections: Vec<BookItem>,
83+
__non_exhaustive: (),
8484
}
8585

8686
impl Book {
@@ -228,7 +228,10 @@ pub(crate) fn load_book_from_disk<P: AsRef<Path>>(summary: &Summary, src_dir: P)
228228
chapters.push(chapter);
229229
}
230230

231-
Ok(Book { sections: chapters })
231+
Ok(Book {
232+
sections: chapters,
233+
__non_exhaustive: (),
234+
})
232235
}
233236

234237
fn load_summary_item<P: AsRef<Path> + Clone>(

src/preprocess/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use serde::{Deserialize, Serialize};
2121
/// Extra information for a `Preprocessor` to give them more context when
2222
/// processing a book.
2323
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
24-
#[non_exhaustive]
2524
pub struct PreprocessorContext {
2625
/// The location of the book directory on disk.
2726
pub root: PathBuf,
@@ -33,6 +32,8 @@ pub struct PreprocessorContext {
3332
pub mdbook_version: String,
3433
#[serde(skip)]
3534
pub(crate) chapter_titles: RefCell<HashMap<PathBuf, String>>,
35+
#[serde(skip)]
36+
__non_exhaustive: (),
3637
}
3738

3839
impl PreprocessorContext {
@@ -44,6 +45,7 @@ impl PreprocessorContext {
4445
renderer,
4546
mdbook_version: crate::MDBOOK_VERSION.to_string(),
4647
chapter_titles: RefCell::new(HashMap::new()),
48+
__non_exhaustive: (),
4749
}
4850
}
4951
}

src/renderer/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ pub trait Renderer {
5151

5252
/// The context provided to all renderers.
5353
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
54-
#[non_exhaustive]
5554
pub struct RenderContext {
5655
/// Which version of `mdbook` did this come from (as written in `mdbook`'s
5756
/// `Cargo.toml`). Useful if you know the renderer is only compatible with
@@ -69,6 +68,8 @@ pub struct RenderContext {
6968
pub destination: PathBuf,
7069
#[serde(skip)]
7170
pub(crate) chapter_titles: HashMap<PathBuf, String>,
71+
#[serde(skip)]
72+
__non_exhaustive: (),
7273
}
7374

7475
impl RenderContext {
@@ -85,6 +86,7 @@ impl RenderContext {
8586
root: root.into(),
8687
destination: destination.into(),
8788
chapter_titles: HashMap::new(),
89+
__non_exhaustive: (),
8890
}
8991
}
9092

0 commit comments

Comments
 (0)