Skip to content

Commit f401737

Browse files
authored
Merge pull request #944 from lzutao/formatting
Minor formatting fixes
2 parents 04e74bf + 672cf45 commit f401737

File tree

8 files changed

+27
-27
lines changed

8 files changed

+27
-27
lines changed

Cargo.toml

+10-10
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,24 @@ repository = "https://github.com/rust-lang-nursery/mdBook"
1616
description = "Creates a book from markdown files"
1717

1818
[dependencies]
19-
clap = "2.24"
2019
chrono = "0.4"
21-
handlebars = { version = "1.0", default-features = false, features = ["no_dir_source"] }
22-
serde = "1.0"
23-
serde_derive = "1.0"
20+
clap = "2.24"
21+
env_logger = "0.6"
2422
error-chain = "0.12"
25-
serde_json = "1.0"
26-
pulldown-cmark = "0.1.2"
23+
handlebars = { version = "1.0", default-features = false, features = ["no_dir_source"] }
24+
itertools = "0.8"
2725
lazy_static = "1.0"
2826
log = "0.4"
29-
env_logger = "0.6"
30-
toml = "0.4.8"
3127
memchr = "2.0"
3228
open = "1.1"
29+
pulldown-cmark = "0.1.2"
3330
regex = "1.0.0"
34-
tempfile = "3.0"
35-
itertools = "0.8"
31+
serde = "1.0"
32+
serde_derive = "1.0"
33+
serde_json = "1.0"
3634
shlex = "0.1"
35+
tempfile = "3.0"
36+
toml = "0.4.8"
3737
toml-query = "0.7"
3838

3939
# Watch feature

src/book/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl MDBook {
6868

6969
config.update_from_env();
7070

71-
if log_enabled!(::log::Level::Trace) {
71+
if log_enabled!(log::Level::Trace) {
7272
for line in format!("Config: {:#?}", config).lines() {
7373
trace!("{}", line);
7474
}

src/cmd/clean.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub fn make_subcommand<'a, 'b>() -> App<'a, 'b> {
2121
}
2222

2323
// Clean command implementation
24-
pub fn execute(args: &ArgMatches) -> ::mdbook::errors::Result<()> {
24+
pub fn execute(args: &ArgMatches) -> mdbook::errors::Result<()> {
2525
let book_dir = get_book_dir(args);
2626
let book = MDBook::load(&book_dir)?;
2727

src/cmd/watch.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ where
6363
Ok(w) => w,
6464
Err(e) => {
6565
error!("Error while trying to watch the files:\n\n\t{:?}", e);
66-
::std::process::exit(1)
66+
std::process::exit(1)
6767
}
6868
};
6969

7070
// Add the source directory to the watcher
7171
if let Err(e) = watcher.watch(book.source_dir(), Recursive) {
7272
error!("Error while watching {:?}:\n {:?}", book.source_dir(), e);
73-
::std::process::exit(1);
73+
std::process::exit(1);
7474
};
7575

7676
let _ = watcher.watch(book.theme_dir(), Recursive);

src/config.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ impl Default for Config {
268268
}
269269
}
270270
impl<'de> Deserialize<'de> for Config {
271-
fn deserialize<D: Deserializer<'de>>(de: D) -> ::std::result::Result<Self, D::Error> {
271+
fn deserialize<D: Deserializer<'de>>(de: D) -> std::result::Result<Self, D::Error> {
272272
let raw = Value::deserialize(de)?;
273273

274274
if is_legacy_format(&raw) {
@@ -312,7 +312,7 @@ impl<'de> Deserialize<'de> for Config {
312312
}
313313

314314
impl Serialize for Config {
315-
fn serialize<S: Serializer>(&self, s: S) -> ::std::result::Result<S::Ok, S::Error> {
315+
fn serialize<S: Serializer>(&self, s: S) -> std::result::Result<S::Ok, S::Error> {
316316
use serde::ser::Error;
317317

318318
let mut table = self.rest.clone();

src/lib.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -122,20 +122,20 @@ pub mod errors {
122122

123123
error_chain! {
124124
foreign_links {
125-
Io(::std::io::Error) #[doc = "A wrapper around `std::io::Error`"];
126-
HandlebarsRender(::handlebars::RenderError) #[doc = "Handlebars rendering failed"];
127-
HandlebarsTemplate(Box<::handlebars::TemplateError>) #[doc = "Unable to parse the template"];
128-
Utf8(::std::string::FromUtf8Error) #[doc = "Invalid UTF-8"];
129-
SerdeJson(::serde_json::Error) #[doc = "JSON conversion failed"];
125+
Io(std::io::Error) #[doc = "A wrapper around `std::io::Error`"];
126+
HandlebarsRender(handlebars::RenderError) #[doc = "Handlebars rendering failed"];
127+
HandlebarsTemplate(Box<handlebars::TemplateError>) #[doc = "Unable to parse the template"];
128+
Utf8(std::string::FromUtf8Error) #[doc = "Invalid UTF-8"];
129+
SerdeJson(serde_json::Error) #[doc = "JSON conversion failed"];
130130
}
131131

132132
links {
133-
TomlQuery(::toml_query::error::Error, ::toml_query::error::ErrorKind) #[doc = "A TomlQuery error"];
133+
TomlQuery(toml_query::error::Error, toml_query::error::ErrorKind) #[doc = "A TomlQuery error"];
134134
}
135135

136136
errors {
137137
/// A subprocess exited with an unsuccessful return code.
138-
Subprocess(message: String, output: ::std::process::Output) {
138+
Subprocess(message: String, output: std::process::Output) {
139139
description("A subprocess failed")
140140
display("{}: {}", message, String::from_utf8_lossy(&output.stdout))
141141
}
@@ -155,8 +155,8 @@ pub mod errors {
155155
}
156156

157157
// Box to halve the size of Error
158-
impl From<::handlebars::TemplateError> for Error {
159-
fn from(e: ::handlebars::TemplateError) -> Error {
158+
impl From<handlebars::TemplateError> for Error {
159+
fn from(e: handlebars::TemplateError) -> Error {
160160
From::from(Box::new(e))
161161
}
162162
}

src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn main() {
5858
if let Err(e) = res {
5959
utils::log_backtrace(&e);
6060

61-
::std::process::exit(101);
61+
std::process::exit(101);
6262
}
6363
}
6464

tests/rendered_output.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ fn theme_dir_overrides_work_correctly() {
403403
let book_dir = book_dir.path();
404404
let theme_dir = book_dir.join("theme");
405405

406-
let mut index = ::mdbook::theme::INDEX.to_vec();
406+
let mut index = mdbook::theme::INDEX.to_vec();
407407
index.extend_from_slice(b"\n<!-- This is a modified index.hbs! -->");
408408

409409
write_file(&theme_dir, "index.hbs", &index).unwrap();

0 commit comments

Comments
 (0)