diff --git a/appveyor.yml b/appveyor.yml index ed01ed9..dad60de 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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% diff --git a/benches/gutenberg.rs b/benches/gutenberg.rs index 2086576..704e404 100644 --- a/benches/gutenberg.rs +++ b/benches/gutenberg.rs @@ -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::>(); + let mut pages = site.pages.values().cloned().collect::>(); pages.sort_by(|a, b| a.partial_cmp(b).unwrap()); b.iter(|| populate_previous_and_next_pages(pages.as_slice(), false)); diff --git a/src/cmd/serve.rs b/src/cmd/serve.rs index 9ceee5a..d97473f 100644 --- a/src/cmd/serve.rs +++ b/src/cmd/serve.rs @@ -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) } } diff --git a/src/main.rs b/src/main.rs index bebca5f..73308b6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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!(),