Skip to content

Commit be63b44

Browse files
authored
Merge pull request #2823 from ehuss/non_exhaustive_remove
Remove non_exhaustive from Book
2 parents 06af133 + 30d3aeb commit be63b44

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

crates/mdbook-core/src/book.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ mod tests;
1818
///
1919
/// [`iter()`]: #method.iter
2020
/// [`for_each_mut()`]: #method.for_each_mut
21+
#[allow(
22+
clippy::exhaustive_structs,
23+
reason = "This cannot be extended without breaking preprocessors."
24+
)]
2125
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
22-
#[non_exhaustive]
2326
pub struct Book {
2427
/// The items in this book.
2528
pub items: Vec<BookItem>,
@@ -80,8 +83,11 @@ where
8083
}
8184

8285
/// Enum representing any type of item which can be added to a book.
86+
#[allow(
87+
clippy::exhaustive_enums,
88+
reason = "This cannot be extended without breaking preprocessors."
89+
)]
8390
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
84-
#[non_exhaustive]
8591
pub enum BookItem {
8692
/// A nested chapter.
8793
Chapter(Chapter),
@@ -99,8 +105,11 @@ impl From<Chapter> for BookItem {
99105

100106
/// The representation of a "chapter", usually mapping to a single file on
101107
/// disk however it may contain multiple sub-chapters.
108+
#[allow(
109+
clippy::exhaustive_structs,
110+
reason = "This cannot be extended without breaking preprocessors."
111+
)]
102112
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
103-
#[non_exhaustive]
104113
pub struct Chapter {
105114
/// The chapter's name.
106115
pub name: String,

crates/mdbook-html/src/html_handlebars/hbs_renderer.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,6 @@ fn make_data(
687687
BookItem::Separator => {
688688
chapter.insert("spacer".to_owned(), json!("_spacer_"));
689689
}
690-
_ => panic!("BookItem {item:?} not covered"),
691690
}
692691

693692
chapters.push(chapter);

0 commit comments

Comments
 (0)