From 89bbc630a68aea3d548d582f3a7628d518af149c Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Thu, 21 Sep 2023 10:20:40 +0000 Subject: [PATCH] Fix lint errors with Rust 1.73 (again) (#679) Fixes #678. GUS-W-14160797. --- libcnb-test/tests/integration_test.rs | 44 +++++++++++++-------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/libcnb-test/tests/integration_test.rs b/libcnb-test/tests/integration_test.rs index 529f92ae..0738b951 100644 --- a/libcnb-test/tests/integration_test.rs +++ b/libcnb-test/tests/integration_test.rs @@ -65,20 +65,20 @@ fn rebuild() { #[test] #[ignore = "integration test"] fn buildpack_packaging_failure() { - let result = std::panic::catch_unwind(|| { + let err = std::panic::catch_unwind(|| { TestRunner::default().build(BuildConfig::new("invalid!", "test-fixtures/empty"), |_| { unreachable!("The test should panic prior to the TestContext being invoked."); }); - }); - match result { - Ok(_) => panic!("expected a failure"), - Err(error) => { - assert_eq!( - error.downcast_ref::().unwrap().to_string(), - format!("Could not package directory as buildpack! No `buildpack.toml` file exists at {}", env::var("CARGO_MANIFEST_DIR").unwrap()) - ); - } - } + }) + .unwrap_err(); + + assert_eq!( + err.downcast_ref::().unwrap().to_string(), + format!( + "Could not package directory as buildpack! No `buildpack.toml` file exists at {}", + env::var("CARGO_MANIFEST_DIR").unwrap() + ) + ); } #[test] @@ -141,7 +141,7 @@ fn expected_pack_failure() { #[test] #[ignore = "integration test"] fn expected_pack_failure_still_panics_for_non_pack_failure() { - let result = std::panic::catch_unwind(|| { + let err = std::panic::catch_unwind(|| { TestRunner::default().build( BuildConfig::new("invalid!", "test-fixtures/empty") .expected_pack_result(PackResult::Failure), @@ -149,16 +149,16 @@ fn expected_pack_failure_still_panics_for_non_pack_failure() { unreachable!("The test should panic prior to the TestContext being invoked."); }, ); - }); - match result { - Ok(_) => panic!("expected a failure"), - Err(error) => { - assert_eq!( - error.downcast_ref::().unwrap().to_string(), - format!("Could not package directory as buildpack! No `buildpack.toml` file exists at {}", env::var("CARGO_MANIFEST_DIR").unwrap()) - ); - } - } + }) + .unwrap_err(); + + assert_eq!( + err.downcast_ref::().unwrap().to_string(), + format!( + "Could not package directory as buildpack! No `buildpack.toml` file exists at {}", + env::var("CARGO_MANIFEST_DIR").unwrap() + ) + ); } #[test]