Skip to content

Commit 37b01ed

Browse files
committed
Merge pull request #5 from steveklabnik/master
Fixes for a clean build.
2 parents e130a1d + 4893d7b commit 37b01ed

File tree

10 files changed

+20
-28
lines changed

10 files changed

+20
-28
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target

Cargo.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/book.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
use std::io::BufferedReader;
44
use std::iter::AdditiveIterator;
55

6-
use regex::Regex;
7-
86
pub struct BookItem {
97
pub title: String,
108
pub path: Path,

src/build.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ use book;
1111
use book::{Book, BookItem};
1212
use css;
1313

14-
use regex::Regex;
15-
1614
struct Build;
1715

1816
pub fn parse_cmd(name: &str) -> Option<Box<Subcommand>> {
@@ -37,7 +35,7 @@ fn write_toc(book: &Book, path_to_root: &Path, out: &mut Writer) -> IoResult<()>
3735
item.title));
3836
if !item.children.is_empty() {
3937
try!(writeln!(out, "<ul class='section'>"));
40-
walk_items(item.children[], section, path_to_root, out);
38+
let _ = walk_items(item.children[], section, path_to_root, out);
4139
try!(writeln!(out, "</ul>"));
4240
}
4341
try!(writeln!(out, "</li>"));
@@ -76,7 +74,7 @@ fn render(book: &Book, tgt: &Path) -> CliResult<()> {
7674
let prelude = tmp.path().join("prelude.html");
7775
{
7876
let mut toc = BufferedWriter::new(try!(File::create(&prelude)));
79-
write_toc(book, &item.path_to_root, &mut toc);
77+
let _ = write_toc(book, &item.path_to_root, &mut toc);
8078
try!(writeln!(&mut toc, "<div id='page-wrapper'>"));
8179
try!(writeln!(&mut toc, "<div id='page'>"));
8280
}
@@ -89,7 +87,7 @@ fn render(book: &Book, tgt: &Path) -> CliResult<()> {
8987
}
9088

9189
let out_path = tgt.join(item.path.dirname());
92-
try!(fs::mkdir_recursive(&out_path, io::UserDir));
90+
try!(fs::mkdir_recursive(&out_path, io::USER_DIR));
9391

9492
let output_result = Command::new("rustdoc")
9593
.arg(&preprocessed_path)
@@ -120,7 +118,7 @@ fn render(book: &Book, tgt: &Path) -> CliResult<()> {
120118
}
121119

122120
impl Subcommand for Build {
123-
fn parse_args(&mut self, args: &[String]) -> CliResult<()> {
121+
fn parse_args(&mut self, _: &[String]) -> CliResult<()> {
124122
Ok(())
125123
}
126124
fn usage(&self) {}
@@ -129,15 +127,15 @@ impl Subcommand for Build {
129127
let src = cwd.clone();
130128
let tgt = cwd.join("_book");
131129

132-
fs::mkdir(&tgt, io::UserDir); // FIXME: handle errors
130+
let _ = fs::mkdir(&tgt, io::USER_DIR); // FIXME: handle errors
133131

134-
File::create(&tgt.join("rust-book.css")).write_str(css::STYLE); // FIXME: handle errors
132+
let _ = File::create(&tgt.join("rust-book.css")).write_str(css::STYLE); // FIXME: handle errors
135133

136134
let summary = File::open(&src.join("SUMMARY.md"));
137135
match book::parse_summary(summary, &src) {
138136
Ok(book) => {
139137
// execute rustdoc on the whole book
140-
render(&book, &tgt).map_err(|err| {
138+
let _ = render(&book, &tgt).map_err(|err| {
141139
term.err(format!("error: {}", err.description())[]);
142140
err.detail().map(|detail| {
143141
term.err(format!("detail: {}", detail)[]);

src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl Error for String {
4444
}
4545

4646
impl FromError<()> for () {
47-
fn from_err(error: ()) -> () { () }
47+
fn from_err(_: ()) -> () { () }
4848
}
4949

5050
impl FromError<IoError> for IoError {

src/help.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ pub fn parse_cmd(name: &str) -> Option<Box<Subcommand>> {
1414
}
1515

1616
impl Subcommand for Help {
17-
fn parse_args(&mut self, args: &[String]) -> CliResult<()> {
17+
fn parse_args(&mut self, _: &[String]) -> CliResult<()> {
1818
Ok(())
1919
}
2020
fn usage(&self) {}
21-
fn execute(&mut self, term: &mut Term) {
21+
fn execute(&mut self, _: &mut Term) {
2222
usage()
2323
}
2424
}

src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ mod test;
3232

3333
mod css;
3434

35+
#[cfg(not(test))] // thanks #12327
3536
fn main() {
3637
let mut term = Term::new();
3738
let cmd = os::args();

src/serve.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ pub fn parse_cmd(name: &str) -> Option<Box<Subcommand>> {
1515
}
1616

1717
impl Subcommand for Serve {
18-
fn parse_args(&mut self, args: &[String]) -> CliResult<()> {
18+
fn parse_args(&mut self, _: &[String]) -> CliResult<()> {
1919
Ok(())
2020
}
2121
fn usage(&self) {}
22-
fn execute(&mut self, term: &mut Term) {}
22+
fn execute(&mut self, _: &mut Term) {}
2323
}

src/term.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,18 @@
22
//! verbosity support. For now, just a wrapper around stdout/stderr.
33
44
use std::io::stdio;
5-
use std::io::IoResult;
65

76
pub struct Term {
8-
verbose: bool,
9-
out: Box<Writer + 'static>,
107
err: Box<Writer + 'static>
118
}
129

1310
impl Term {
1411
pub fn new() -> Term {
1512
Term {
16-
verbose: false,
17-
out: box stdio::stdout() as Box<Writer>,
1813
err: box stdio::stderr() as Box<Writer>,
1914
}
2015
}
2116

22-
pub fn out(&mut self, msg: &str) {
23-
// swallow any errors
24-
let _ = self.out.write_line(msg);
25-
}
26-
2717
pub fn err(&mut self, msg: &str) {
2818
// swallow any errors
2919
let _ = self.err.write_line(msg);

src/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ pub fn parse_cmd(name: &str) -> Option<Box<Subcommand>> {
1515
}
1616

1717
impl Subcommand for Test {
18-
fn parse_args(&mut self, args: &[String]) -> CliResult<()> {
18+
fn parse_args(&mut self, _: &[String]) -> CliResult<()> {
1919
Ok(())
2020
}
2121
fn usage(&self) {}
22-
fn execute(&mut self, term: &mut Term) {}
22+
fn execute(&mut self, _: &mut Term) {}
2323
}

0 commit comments

Comments
 (0)