From 0dad0068223fa149f7a5dfb5cd171342d97f25c9 Mon Sep 17 00:00:00 2001 From: realaravinth Date: Sun, 11 Jul 2021 21:48:30 +0530 Subject: [PATCH] force rerun if source changes & address clippy warnings --- examples/actix-web/src/main.rs | 8 ++++---- src/processor.rs | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/examples/actix-web/src/main.rs b/examples/actix-web/src/main.rs index c94210c..d8f08f2 100644 --- a/examples/actix-web/src/main.rs +++ b/examples/actix-web/src/main.rs @@ -130,10 +130,10 @@ mod tests { #[actix_rt::test] async fn static_assets_work() { - let mut app = test::init_service(App::new().configure(services)).await; + let app = test::init_service(App::new().configure(services)).await; let img_resp = test::call_service( - &mut app, + &app, test::TestRequest::get() .uri( &crate::FILES @@ -146,7 +146,7 @@ mod tests { assert_eq!(img_resp.status(), StatusCode::OK); let css_resp = test::call_service( - &mut app, + &app, test::TestRequest::get() .uri( &crate::FILES @@ -159,7 +159,7 @@ mod tests { assert_eq!(css_resp.status(), StatusCode::OK); let favicon_resp = test::call_service( - &mut app, + &app, test::TestRequest::get().uri("/favicon.ico").to_request(), ) .await; diff --git a/src/processor.rs b/src/processor.rs index aa3bd4a..7049b0a 100644 --- a/src/processor.rs +++ b/src/processor.rs @@ -118,6 +118,7 @@ impl<'a> Buster<'a> { // creates base_dir to output files to fn init(&self) -> Result<(), Error> { let res = Path::new(&self.result); + println!("cargo:rerun-if-changed={}", self.source); if res.exists() { fs::remove_dir_all(&self.result).unwrap(); } @@ -429,7 +430,7 @@ pub mod tests { let source = Path::new(k); let dest = Path::new(&v); let no_hash = Path::new(file); - source == &Path::new(&config.source).join(file) + source == Path::new(&config.source).join(file) && dest.exists() && no_hash.file_name() == dest.file_name() })); @@ -507,7 +508,7 @@ pub mod tests { config.process().unwrap(); let files = Files::load(); - assert!(files.map.iter().any(|(k, v)| { + assert!(files.map.iter().any(|(_k, v)| { let dest = Path::new(&v); dest.extension().unwrap().to_str().unwrap() == APPLICATION_WASM && dest.exists() })); @@ -526,7 +527,7 @@ pub mod tests { let source = Path::new(k); let dest = Path::new(&v); let no_hash = Path::new(file); - source == &Path::new(&config.source).join(file) + source == Path::new(&config.source).join(file) && dest.exists() && no_hash.file_name() == dest.file_name() }));