From 5a899992fefb7728fd0deaa89f11b8289d68188d Mon Sep 17 00:00:00 2001 From: binlingyu Date: Thu, 23 May 2024 10:57:47 +0800 Subject: [PATCH 1/2] used assert macro with a literal bool --- src/config.rs | 9 ++++----- tests/custom_preprocessors.rs | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/config.rs b/src/config.rs index eba95286f7..758bf2c704 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1331,7 +1331,7 @@ mod tests { smart-punctuation = true "#; let config = Config::from_str(src).unwrap(); - assert_eq!(config.html_config().unwrap().smart_punctuation(), true); + assert!(config.html_config().unwrap().smart_punctuation()); let src = r#" [book] @@ -1341,16 +1341,15 @@ mod tests { curly-quotes = true "#; let config = Config::from_str(src).unwrap(); - assert_eq!(config.html_config().unwrap().smart_punctuation(), true); + assert!(config.html_config().unwrap().smart_punctuation()); let src = r#" [book] title = "mdBook Documentation" "#; let config = Config::from_str(src).unwrap(); - assert_eq!( - config.html_config().unwrap_or_default().smart_punctuation(), - false + assert!( + !config.html_config().unwrap_or_default().smart_punctuation() ); } } diff --git a/tests/custom_preprocessors.rs b/tests/custom_preprocessors.rs index 8237602de0..3cc67af607 100644 --- a/tests/custom_preprocessors.rs +++ b/tests/custom_preprocessors.rs @@ -17,7 +17,7 @@ fn example_supports_whatever() { let got = cmd.supports_renderer("whatever"); - assert_eq!(got, true); + assert!(got); } #[test] @@ -26,7 +26,7 @@ fn example_doesnt_support_not_supported() { let got = cmd.supports_renderer("not-supported"); - assert_eq!(got, false); + assert!(!got); } #[test] From db26797e688b96c18934c745d909e812bc18a016 Mon Sep 17 00:00:00 2001 From: binlingyu Date: Thu, 23 May 2024 11:15:01 +0800 Subject: [PATCH 2/2] cargo fmt --- src/config.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/config.rs b/src/config.rs index 758bf2c704..9db79a7aac 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1348,8 +1348,6 @@ mod tests { title = "mdBook Documentation" "#; let config = Config::from_str(src).unwrap(); - assert!( - !config.html_config().unwrap_or_default().smart_punctuation() - ); + assert!(!config.html_config().unwrap_or_default().smart_punctuation()); } }