Clippy + appveyor
This commit is contained in:
parent
a02d50c22a
commit
0aef05ac8e
|
@ -23,9 +23,9 @@ environment:
|
||||||
install:
|
install:
|
||||||
- ps: >-
|
- ps: >-
|
||||||
If ($Env:TARGET -eq 'x86_64-pc-windows-gnu') {
|
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') {
|
} 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/
|
- curl -sSf -o rustup-init.exe https://win.rustup.rs/
|
||||||
- rustup-init.exe -y --default-host %TARGET% --default-toolchain %RUST_VERSION%
|
- rustup-init.exe -y --default-host %TARGET% --default-toolchain %RUST_VERSION%
|
||||||
|
|
|
@ -14,7 +14,7 @@ use gutenberg::{Site, populate_previous_and_next_pages};
|
||||||
fn bench_loading_test_site(b: &mut test::Bencher) {
|
fn bench_loading_test_site(b: &mut test::Bencher) {
|
||||||
let mut path = env::current_dir().unwrap().to_path_buf();
|
let mut path = env::current_dir().unwrap().to_path_buf();
|
||||||
path.push("test_site");
|
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());
|
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) {
|
fn bench_building_test_site(b: &mut test::Bencher) {
|
||||||
let mut path = env::current_dir().unwrap().to_path_buf();
|
let mut path = env::current_dir().unwrap().to_path_buf();
|
||||||
path.push("test_site");
|
path.push("test_site");
|
||||||
let mut site = Site::new(&path).unwrap();
|
let mut site = Site::new(&path, "config.toml").unwrap();
|
||||||
site.load().unwrap();
|
site.load().unwrap();
|
||||||
let tmp_dir = TempDir::new("example").expect("create temp dir");
|
let tmp_dir = TempDir::new("example").expect("create temp dir");
|
||||||
let public = &tmp_dir.path().join("public");
|
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) {
|
fn bench_populate_previous_and_next_pages(b: &mut test::Bencher) {
|
||||||
let mut path = env::current_dir().unwrap().to_path_buf();
|
let mut path = env::current_dir().unwrap().to_path_buf();
|
||||||
path.push("test_site");
|
path.push("test_site");
|
||||||
let mut site = Site::new(&path).unwrap();
|
let mut site = Site::new(&path, "config.toml").unwrap();
|
||||||
site.load().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());
|
pages.sort_by(|a, b| a.partial_cmp(b).unwrap());
|
||||||
|
|
||||||
b.iter(|| populate_previous_and_next_pages(pages.as_slice(), false));
|
b.iter(|| populate_previous_and_next_pages(pages.as_slice(), false));
|
||||||
|
|
|
@ -47,7 +47,7 @@ fn rebuild_done_handling(broadcaster: &Sender, res: Result<()>, reload_path: &st
|
||||||
}}"#, reload_path)
|
}}"#, reload_path)
|
||||||
).unwrap();
|
).unwrap();
|
||||||
},
|
},
|
||||||
Err(e) => unravel_errors("Failed to build the site", e, false)
|
Err(e) => unravel_errors("Failed to build the site", &e, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
src/main.rs
12
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
|
////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(message);
|
||||||
console::error(&format!("Error: {}", error));
|
console::error(&format!("Error: {}", error));
|
||||||
for e in error.iter().skip(1) {
|
for e in error.iter().skip(1) {
|
||||||
|
@ -74,24 +74,24 @@ fn main() {
|
||||||
("init", Some(matches)) => {
|
("init", Some(matches)) => {
|
||||||
match cmd::create_new_project(matches.value_of("name").unwrap()) {
|
match cmd::create_new_project(matches.value_of("name").unwrap()) {
|
||||||
Ok(()) => console::success("Project created"),
|
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(_)) => {
|
("build", Some(_)) => {
|
||||||
console::info("Building site...");
|
console::info("Building site...");
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
match cmd::build(&config_file) {
|
match cmd::build(config_file) {
|
||||||
Ok(()) => report_elapsed_time(start),
|
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)) => {
|
("serve", Some(matches)) => {
|
||||||
let interface = matches.value_of("interface").unwrap_or("127.0.0.1");
|
let interface = matches.value_of("interface").unwrap_or("127.0.0.1");
|
||||||
let port = matches.value_of("port").unwrap_or("1111");
|
let port = matches.value_of("port").unwrap_or("1111");
|
||||||
console::info("Building site...");
|
console::info("Building site...");
|
||||||
match cmd::serve(interface, port, &config_file) {
|
match cmd::serve(interface, port, config_file) {
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(e) => unravel_errors("Failed to build the site", e, true),
|
Err(e) => unravel_errors("Failed to build the site", &e, true),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
|
|
Loading…
Reference in a new issue