Skip to content

Commit 42d6fd5

Browse files
authored
Merge pull request rust-lang#1848 from FauconFan/remove_non_exhaustive
remove __non_exhaustive members, add non_exhaustive attribute instead
2 parents 53055e0 + 11781f0 commit 42d6fd5

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

src/book/book.rs

Lines changed: 2 additions & 5 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]
8081
pub struct Book {
8182
/// The sections in this book.
8283
pub sections: Vec<BookItem>,
83-
__non_exhaustive: (),
8484
}
8585

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

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

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

src/preprocess/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ 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]
2425
pub struct PreprocessorContext {
2526
/// The location of the book directory on disk.
2627
pub root: PathBuf,
@@ -32,8 +33,6 @@ pub struct PreprocessorContext {
3233
pub mdbook_version: String,
3334
#[serde(skip)]
3435
pub(crate) chapter_titles: RefCell<HashMap<PathBuf, String>>,
35-
#[serde(skip)]
36-
__non_exhaustive: (),
3736
}
3837

3938
impl PreprocessorContext {
@@ -45,7 +44,6 @@ impl PreprocessorContext {
4544
renderer,
4645
mdbook_version: crate::MDBOOK_VERSION.to_string(),
4746
chapter_titles: RefCell::new(HashMap::new()),
48-
__non_exhaustive: (),
4947
}
5048
}
5149
}

src/renderer/mod.rs

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

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

7574
impl RenderContext {
@@ -86,7 +85,6 @@ impl RenderContext {
8685
root: root.into(),
8786
destination: destination.into(),
8887
chapter_titles: HashMap::new(),
89-
__non_exhaustive: (),
9088
}
9189
}
9290

0 commit comments

Comments
 (0)