From 32f2733a2e1a449ac06adefa46061e71baf14f35 Mon Sep 17 00:00:00 2001 From: Julian Ganz Date: Fri, 26 Mar 2021 19:53:18 +0100 Subject: [PATCH 1/2] Shut up non_fmt_panic warning Like a few other macros, `panic!` accepts a format string and arguments. The format string is meant to be static and calling it with a message string will generate a warning. Currently, the warning also indicates that `rustc` will generate an error instead in the near future. --- src/tester.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tester.rs b/src/tester.rs index e2eaa20..d9fe7f2 100644 --- a/src/tester.rs +++ b/src/tester.rs @@ -162,7 +162,7 @@ impl QuickCheck { let n_tests_passed = match self.quicktest(f) { Ok(n_tests_passed) => n_tests_passed, - Err(result) => panic!(result.failed_msg()), + Err(result) => panic!("{}", result.failed_msg()), }; if n_tests_passed >= self.min_tests_passed { From cf2bfa41e437689b3ff2f4002c00a3cdb57cadf6 Mon Sep 17 00:00:00 2001 From: Julian Ganz Date: Fri, 26 Mar 2021 20:12:31 +0100 Subject: [PATCH 2/2] Eliminate redundant format! in panic! The `panic!` matro itself does take a foramt string. In fact, the redundant format generated a warning. --- src/arbitrary.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/arbitrary.rs b/src/arbitrary.rs index 92f893b..ccc00a2 100644 --- a/src/arbitrary.rs +++ b/src/arbitrary.rs @@ -1365,11 +1365,11 @@ mod test { for n in v { let found = shrunk.iter().any(|&i| i == n); if !found { - panic!(format!( + panic!( "Element {:?} was not found \ in shrink results {:?}", n, shrunk - )); + ); } } }