Clippy + appveyor

This commit is contained in:
Vincent Prouillet 2017-03-25 15:59:12 +09:00
parent a02d50c22a
commit 0aef05ac8e
4 changed files with 13 additions and 13 deletions

View file

@ -23,9 +23,9 @@ environment:
install:
- ps: >-
If ($Env:TARGET -eq 'x86_64-pc-windows-gnu') {
$Env:PATH += ';C:\msys64\mingw64\bin'
$Env:PATH += ';C:\msys64\mingw64\bin;C:\Program Files\Git\mingw64\bin'
} ElseIf ($Env:TARGET -eq 'i686-pc-windows-gnu') {
$Env:PATH += ';C:\msys64\mingw32\bin'
$Env:PATH += ';C:\msys64\mingw32\bin;C:\Program Files\Git\mingw64\bin'
}
- curl -sSf -o rustup-init.exe https://win.rustup.rs/
- rustup-init.exe -y --default-host %TARGET% --default-toolchain %RUST_VERSION%

View file

@ -14,7 +14,7 @@ use gutenberg::{Site, populate_previous_and_next_pages};
fn bench_loading_test_site(b: &mut test::Bencher) {
let mut path = env::current_dir().unwrap().to_path_buf();
path.push("test_site");
let mut site = Site::new(&path).unwrap();
let mut site = Site::new(&path, "config.toml").unwrap();
b.iter(|| site.load().unwrap());
@ -25,7 +25,7 @@ fn bench_loading_test_site(b: &mut test::Bencher) {
fn bench_building_test_site(b: &mut test::Bencher) {
let mut path = env::current_dir().unwrap().to_path_buf();
path.push("test_site");
let mut site = Site::new(&path).unwrap();
let mut site = Site::new(&path, "config.toml").unwrap();
site.load().unwrap();
let tmp_dir = TempDir::new("example").expect("create temp dir");
let public = &tmp_dir.path().join("public");
@ -39,9 +39,9 @@ fn bench_building_test_site(b: &mut test::Bencher) {
fn bench_populate_previous_and_next_pages(b: &mut test::Bencher) {
let mut path = env::current_dir().unwrap().to_path_buf();
path.push("test_site");
let mut site = Site::new(&path).unwrap();
let mut site = Site::new(&path, "config.toml").unwrap();
site.load().unwrap();
let mut pages = site.pages.values().map(|p| p.clone()).collect::<Vec<_>>();
let mut pages = site.pages.values().cloned().collect::<Vec<_>>();
pages.sort_by(|a, b| a.partial_cmp(b).unwrap());
b.iter(|| populate_previous_and_next_pages(pages.as_slice(), false));

View file

@ -47,7 +47,7 @@ fn rebuild_done_handling(broadcaster: &Sender, res: Result<()>, reload_path: &st
}}"#, reload_path)
).unwrap();
},
Err(e) => unravel_errors("Failed to build the site", e, false)
Err(e) => unravel_errors("Failed to build the site", &e, false)
}
}

View file

@ -35,7 +35,7 @@ fn report_elapsed_time(instant: Instant) {
}
////Display an error message, the actual error and then exits if requested
fn unravel_errors(message: &str, error: Error, exit: bool) {
fn unravel_errors(message: &str, error: &Error, exit: bool) {
console::error(message);
console::error(&format!("Error: {}", error));
for e in error.iter().skip(1) {
@ -74,24 +74,24 @@ fn main() {
("init", Some(matches)) => {
match cmd::create_new_project(matches.value_of("name").unwrap()) {
Ok(()) => console::success("Project created"),
Err(e) => unravel_errors("Failed to create the project", e, true),
Err(e) => unravel_errors("Failed to create the project", &e, true),
};
},
("build", Some(_)) => {
console::info("Building site...");
let start = Instant::now();
match cmd::build(&config_file) {
match cmd::build(config_file) {
Ok(()) => report_elapsed_time(start),
Err(e) => unravel_errors("Failed to build the site", e, true),
Err(e) => unravel_errors("Failed to build the site", &e, true),
};
},
("serve", Some(matches)) => {
let interface = matches.value_of("interface").unwrap_or("127.0.0.1");
let port = matches.value_of("port").unwrap_or("1111");
console::info("Building site...");
match cmd::serve(interface, port, &config_file) {
match cmd::serve(interface, port, config_file) {
Ok(()) => (),
Err(e) => unravel_errors("Failed to build the site", e, true),
Err(e) => unravel_errors("Failed to build the site", &e, true),
};
},
_ => unreachable!(),