Skip to content

Commit e36d8cd

Browse files
committed
update mdbook
This eliminates some warnings
1 parent dead08c commit e36d8cd

File tree

3 files changed

+18
-27
lines changed

3 files changed

+18
-27
lines changed

src/Cargo.lock

+10-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tools/rustbook/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ license = "MIT/Apache-2.0"
88
clap = "2.25.0"
99

1010
[dependencies.mdbook]
11-
version = "0.0.22"
11+
version = "0.0.25"
1212
default-features = false

src/tools/rustbook/src/main.rs

+7-20
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ extern crate mdbook;
1313
extern crate clap;
1414

1515
use std::env;
16-
use std::error::Error;
1716
use std::io::{self, Write};
1817
use std::path::{Path, PathBuf};
1918

2019
use clap::{App, ArgMatches, SubCommand, AppSettings};
2120

2221
use mdbook::MDBook;
22+
use mdbook::errors::Result;
2323

2424
fn main() {
2525
let d_message = "-d, --dest-dir=[dest-dir]
@@ -49,34 +49,21 @@ fn main() {
4949
::std::process::exit(101);
5050
}
5151
}
52-
5352
// Build command implementation
54-
fn build(args: &ArgMatches) -> Result<(), Box<Error>> {
55-
let book = build_mdbook_struct(args);
53+
pub fn build(args: &ArgMatches) -> Result<()> {
54+
let book_dir = get_book_dir(args);
55+
let book = MDBook::new(&book_dir).read_config()?;
5656

5757
let mut book = match args.value_of("dest-dir") {
58-
Some(dest_dir) => book.set_dest(Path::new(dest_dir)),
59-
None => book
58+
Some(dest_dir) => book.with_destination(dest_dir),
59+
None => book,
6060
};
6161

62-
try!(book.build());
62+
book.build()?;
6363

6464
Ok(())
6565
}
6666

67-
fn build_mdbook_struct(args: &ArgMatches) -> mdbook::MDBook {
68-
let book_dir = get_book_dir(args);
69-
let mut book = MDBook::new(&book_dir).read_config();
70-
71-
// By default mdbook will attempt to create non-existent files referenced
72-
// from SUMMARY.md files. This is problematic on CI where we mount the
73-
// source directory as readonly. To avoid any issues, we'll disabled
74-
// mdbook's implicit file creation feature.
75-
book.create_missing = false;
76-
77-
book
78-
}
79-
8067
fn get_book_dir(args: &ArgMatches) -> PathBuf {
8168
if let Some(dir) = args.value_of("dir") {
8269
// Check if path is relative from current dir, or absolute...

0 commit comments

Comments
 (0)