summaryrefslogtreecommitdiffstats
path: root/vendor/mdbook/src/book/book.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/mdbook/src/book/book.rs')
-rw-r--r--vendor/mdbook/src/book/book.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/vendor/mdbook/src/book/book.rs b/vendor/mdbook/src/book/book.rs
index b46843df5..96c70abc4 100644
--- a/vendor/mdbook/src/book/book.rs
+++ b/vendor/mdbook/src/book/book.rs
@@ -39,9 +39,7 @@ fn create_missing(src_dir: &Path, summary: &Summary) -> Result<()> {
.chain(summary.suffix_chapters.iter())
.collect();
- while !items.is_empty() {
- let next = items.pop().expect("already checked");
-
+ while let Some(next) = items.pop() {
if let SummaryItem::Link(ref link) = *next {
if let Some(ref location) = link.location {
let filename = src_dir.join(location);
@@ -277,7 +275,7 @@ fn load_chapter<P: AsRef<Path>>(
}
let stripped = location
- .strip_prefix(&src_dir)
+ .strip_prefix(src_dir)
.expect("Chapters are always inside a book");
Chapter::new(&link.name, content, stripped, parent_names.clone())
@@ -317,7 +315,7 @@ impl<'a> Iterator for BookItems<'a> {
fn next(&mut self) -> Option<Self::Item> {
let item = self.items.pop_front();
- if let Some(&BookItem::Chapter(ref ch)) = item {
+ if let Some(BookItem::Chapter(ch)) = item {
// if we wanted a breadth-first iterator we'd `extend()` here
for sub_item in ch.sub_items.iter().rev() {
self.items.push_front(sub_item);