summaryrefslogtreecommitdiffstats
path: root/vendor/mdbook/src/book
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/mdbook/src/book')
-rw-r--r--vendor/mdbook/src/book/book.rs8
-rw-r--r--vendor/mdbook/src/book/init.rs7
-rw-r--r--vendor/mdbook/src/book/mod.rs12
3 files changed, 12 insertions, 15 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);
diff --git a/vendor/mdbook/src/book/init.rs b/vendor/mdbook/src/book/init.rs
index ebcdd9349..faca1d09a 100644
--- a/vendor/mdbook/src/book/init.rs
+++ b/vendor/mdbook/src/book/init.rs
@@ -198,8 +198,7 @@ impl BookBuilder {
writeln!(f, "- [Chapter 1](./chapter_1.md)")?;
let chapter_1 = src_dir.join("chapter_1.md");
- let mut f =
- File::create(&chapter_1).with_context(|| "Unable to create chapter_1.md")?;
+ let mut f = File::create(chapter_1).with_context(|| "Unable to create chapter_1.md")?;
writeln!(f, "# Chapter 1")?;
} else {
trace!("Existing summary found, no need to create stub files.");
@@ -212,10 +211,10 @@ impl BookBuilder {
fs::create_dir_all(&self.root)?;
let src = self.root.join(&self.config.book.src);
- fs::create_dir_all(&src)?;
+ fs::create_dir_all(src)?;
let build = self.root.join(&self.config.build.build_dir);
- fs::create_dir_all(&build)?;
+ fs::create_dir_all(build)?;
Ok(())
}
diff --git a/vendor/mdbook/src/book/mod.rs b/vendor/mdbook/src/book/mod.rs
index 33fe93f7f..a5e3e78c6 100644
--- a/vendor/mdbook/src/book/mod.rs
+++ b/vendor/mdbook/src/book/mod.rs
@@ -99,7 +99,7 @@ impl MDBook {
let root = book_root.into();
let src_dir = root.join(&config.book.src);
- let book = book::load_book(&src_dir, &config.build)?;
+ let book = book::load_book(src_dir, &config.build)?;
let renderers = determine_renderers(&config);
let preprocessors = determine_preprocessors(&config)?;
@@ -122,7 +122,7 @@ impl MDBook {
let root = book_root.into();
let src_dir = root.join(&config.book.src);
- let book = book::load_book_from_disk(&summary, &src_dir)?;
+ let book = book::load_book_from_disk(&summary, src_dir)?;
let renderers = determine_renderers(&config);
let preprocessors = determine_preprocessors(&config)?;
@@ -309,7 +309,7 @@ impl MDBook {
info!("Testing chapter '{}': {:?}", ch.name, chapter_path);
// write preprocessed file to tempdir
- let path = temp_dir.path().join(&chapter_path);
+ let path = temp_dir.path().join(chapter_path);
let mut tmpf = utils::fs::create_file(&path)?;
tmpf.write_all(ch.content.as_bytes())?;
@@ -319,13 +319,13 @@ impl MDBook {
if let Some(edition) = self.config.rust.edition {
match edition {
RustEdition::E2015 => {
- cmd.args(&["--edition", "2015"]);
+ cmd.args(["--edition", "2015"]);
}
RustEdition::E2018 => {
- cmd.args(&["--edition", "2018"]);
+ cmd.args(["--edition", "2018"]);
}
RustEdition::E2021 => {
- cmd.args(&["--edition", "2021"]);
+ cmd.args(["--edition", "2021"]);
}
}
}