From c1b2bec7d7a56909f695f103d316453dab68798e Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Sun, 30 May 2021 14:53:35 +0200 Subject: [PATCH] book: use non_exhaustive attribute for struct Book As suggested by clippy: https://rust-lang.github.io/rust-clippy/master/index.html#manual_non_exhaustive --- src/book/book.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/book/book.rs b/src/book/book.rs index 048aef28..ae64b120 100644 --- a/src/book/book.rs +++ b/src/book/book.rs @@ -74,10 +74,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>(