force rerun if source changes & address clippy warnings

This commit is contained in:
Aravinth Manivannan 2021-07-11 21:48:30 +05:30
parent 8e630d8e45
commit 0dad006822
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88
2 changed files with 8 additions and 7 deletions

View file

@ -130,10 +130,10 @@ mod tests {
#[actix_rt::test] #[actix_rt::test]
async fn static_assets_work() { 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( let img_resp = test::call_service(
&mut app, &app,
test::TestRequest::get() test::TestRequest::get()
.uri( .uri(
&crate::FILES &crate::FILES
@ -146,7 +146,7 @@ mod tests {
assert_eq!(img_resp.status(), StatusCode::OK); assert_eq!(img_resp.status(), StatusCode::OK);
let css_resp = test::call_service( let css_resp = test::call_service(
&mut app, &app,
test::TestRequest::get() test::TestRequest::get()
.uri( .uri(
&crate::FILES &crate::FILES
@ -159,7 +159,7 @@ mod tests {
assert_eq!(css_resp.status(), StatusCode::OK); assert_eq!(css_resp.status(), StatusCode::OK);
let favicon_resp = test::call_service( let favicon_resp = test::call_service(
&mut app, &app,
test::TestRequest::get().uri("/favicon.ico").to_request(), test::TestRequest::get().uri("/favicon.ico").to_request(),
) )
.await; .await;

View file

@ -118,6 +118,7 @@ impl<'a> Buster<'a> {
// creates base_dir to output files to // creates base_dir to output files to
fn init(&self) -> Result<(), Error> { fn init(&self) -> Result<(), Error> {
let res = Path::new(&self.result); let res = Path::new(&self.result);
println!("cargo:rerun-if-changed={}", self.source);
if res.exists() { if res.exists() {
fs::remove_dir_all(&self.result).unwrap(); fs::remove_dir_all(&self.result).unwrap();
} }
@ -429,7 +430,7 @@ pub mod tests {
let source = Path::new(k); let source = Path::new(k);
let dest = Path::new(&v); let dest = Path::new(&v);
let no_hash = Path::new(file); let no_hash = Path::new(file);
source == &Path::new(&config.source).join(file) source == Path::new(&config.source).join(file)
&& dest.exists() && dest.exists()
&& no_hash.file_name() == dest.file_name() && no_hash.file_name() == dest.file_name()
})); }));
@ -507,7 +508,7 @@ pub mod tests {
config.process().unwrap(); config.process().unwrap();
let files = Files::load(); let files = Files::load();
assert!(files.map.iter().any(|(k, v)| { assert!(files.map.iter().any(|(_k, v)| {
let dest = Path::new(&v); let dest = Path::new(&v);
dest.extension().unwrap().to_str().unwrap() == APPLICATION_WASM && dest.exists() dest.extension().unwrap().to_str().unwrap() == APPLICATION_WASM && dest.exists()
})); }));
@ -526,7 +527,7 @@ pub mod tests {
let source = Path::new(k); let source = Path::new(k);
let dest = Path::new(&v); let dest = Path::new(&v);
let no_hash = Path::new(file); let no_hash = Path::new(file);
source == &Path::new(&config.source).join(file) source == Path::new(&config.source).join(file)
&& dest.exists() && dest.exists()
&& no_hash.file_name() == dest.file_name() && no_hash.file_name() == dest.file_name()
})); }));