diff --git a/googletest/src/fmt.rs b/googletest/src/fmt.rs index b93c263d..e78228bd 100644 --- a/googletest/src/fmt.rs +++ b/googletest/src/fmt.rs @@ -48,7 +48,7 @@ pub mod internal { impl FormatNonDebugFallback for FormatWrapper<'_, T> { #[track_caller] fn __googletest_write_expr_value(&self, output: &mut dyn Write, expr_label: &str) { - write!(output, "\n {} does not implement Debug,", expr_label) + write!(output, "\n {expr_label} does not implement Debug,") .expect("Formatting to String should never fail"); } } diff --git a/googletest/src/internal/description_renderer.rs b/googletest/src/internal/description_renderer.rs index bd2914c2..4be7001c 100644 --- a/googletest/src/internal/description_renderer.rs +++ b/googletest/src/internal/description_renderer.rs @@ -130,7 +130,7 @@ impl List { match self.1 { Decoration::None => "".into(), Decoration::Bullet => "* ".into(), - Decoration::Enumerate => format!("{:>enumeration_padding$}. ", index).into(), + Decoration::Enumerate => format!("{index:>enumeration_padding$}. ").into(), } } diff --git a/googletest/src/internal/test_outcome.rs b/googletest/src/internal/test_outcome.rs index edc8d2ba..341eb72f 100644 --- a/googletest/src/internal/test_outcome.rs +++ b/googletest/src/internal/test_outcome.rs @@ -181,8 +181,8 @@ enum Location { impl Display for Location { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { - Location::Real(l) => write!(f, "{}", l), - Location::Fake { file, line, column } => write!(f, "{}:{}:{}", file, line, column), + Location::Real(l) => write!(f, "{l}"), + Location::Fake { file, line, column } => write!(f, "{file}:{line}:{column}"), } } } @@ -210,7 +210,7 @@ impl TestAssertionFailure { pub(crate) fn log(&self) { TestOutcome::fail_current_test(); - println!("{}", self); + println!("{self}"); } } @@ -218,7 +218,7 @@ impl Display for TestAssertionFailure { fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error> { writeln!(f, "{}", self.description)?; if let Some(custom_message) = &self.custom_message { - writeln!(f, "{}", custom_message)?; + writeln!(f, "{custom_message}")?; } writeln!(f, " at {}", self.location) } diff --git a/googletest/src/matcher_support/match_matrix.rs b/googletest/src/matcher_support/match_matrix.rs index 53f63b76..98dc52ab 100644 --- a/googletest/src/matcher_support/match_matrix.rs +++ b/googletest/src/matcher_support/match_matrix.rs @@ -48,17 +48,17 @@ pub mod internal { ) -> Option { let actual_size = count_elements(actual); match self { - Requirements::PerfectMatch if actual_size != expected_size => Some( - format!("which has size {} (expected {})", actual_size, expected_size).into(), - ), + Requirements::PerfectMatch if actual_size != expected_size => { + Some(format!("which has size {actual_size} (expected {expected_size})").into()) + } Requirements::Superset if actual_size < expected_size => Some( - format!("which has size {} (expected at least {})", actual_size, expected_size) + format!("which has size {actual_size} (expected at least {expected_size})") .into(), ), Requirements::Subset if actual_size > expected_size => Some( - format!("which has size {} (expected at most {})", actual_size, expected_size) + format!("which has size {actual_size} (expected at most {expected_size})") .into(), ), @@ -342,13 +342,13 @@ pub mod internal { let unmatchable_actual = self.unmatchable_actual(); let actual_idx = unmatchable_actual .iter() - .map(|idx| format!("#{}", idx)) + .map(|idx| format!("#{idx}")) .collect::>() .join(", "); let unmatchable_expected = self.unmatchable_expected(); let expected_idx = unmatchable_expected .iter() - .map(|idx| format!("#{}", idx)) + .map(|idx| format!("#{idx}")) .collect::>() .join(", "); match (unmatchable_actual.len(), unmatchable_expected.len()) { diff --git a/googletest/src/matcher_support/summarize_diff.rs b/googletest/src/matcher_support/summarize_diff.rs index ad31f2d6..09b64bcd 100644 --- a/googletest/src/matcher_support/summarize_diff.rs +++ b/googletest/src/matcher_support/summarize_diff.rs @@ -444,7 +444,7 @@ mod tests { write!(&mut text, "{}", collection.next().expect("Provided collection without elements")) .unwrap(); for item in collection { - write!(&mut text, "\n{}", item).unwrap(); + write!(&mut text, "\n{item}").unwrap(); } text } diff --git a/googletest/src/matchers/container_eq_matcher.rs b/googletest/src/matchers/container_eq_matcher.rs index ca83a64b..4829f950 100644 --- a/googletest/src/matchers/container_eq_matcher.rs +++ b/googletest/src/matchers/container_eq_matcher.rs @@ -244,7 +244,7 @@ where .nested( self.expected .into_iter() - .map(|element| format!("{:?}", element)) + .map(|element| format!("{element:?}")) .collect::() .bullet_list(), ) diff --git a/googletest/src/matchers/contains_matcher.rs b/googletest/src/matchers/contains_matcher.rs index 87a666fc..b4ebb1af 100644 --- a/googletest/src/matchers/contains_matcher.rs +++ b/googletest/src/matchers/contains_matcher.rs @@ -106,7 +106,7 @@ where fn explain_match(&self, actual: ContainerT) -> Description { let count = self.count_matches(actual); match (count, &self.count) { - (_, Some(_)) => format!("which contains {} matching elements", count).into(), + (_, Some(_)) => format!("which contains {count} matching elements").into(), (0, None) => "which does not contain a matching element".into(), (_, None) => "which contains a matching element".into(), } diff --git a/googletest/src/matchers/display_matcher.rs b/googletest/src/matchers/display_matcher.rs index 990643b1..42b6bf09 100644 --- a/googletest/src/matchers/display_matcher.rs +++ b/googletest/src/matchers/display_matcher.rs @@ -95,7 +95,7 @@ mod tests { } impl Display for Struct { fn fmt(&self, f: &mut Formatter<'_>) -> std::result::Result<(), Error> { - write!(f, "{:?}", self) + write!(f, "{self:?}") } } verify_that!(Struct { a: 123, b: 321 }, displays_as(eq("Struct { a: 123, b: 321 }")))?; diff --git a/googletest/src/matchers/eq_matcher.rs b/googletest/src/matchers/eq_matcher.rs index 1a7dee37..33b3f902 100644 --- a/googletest/src/matchers/eq_matcher.rs +++ b/googletest/src/matchers/eq_matcher.rs @@ -97,7 +97,7 @@ impl> Matcher for EqMatcher { fn explain_match(&self, actual: A) -> Description { let expected_debug = format!("{:#?}", self.expected); - let actual_debug = format!("{:#?}", actual); + let actual_debug = format!("{actual:#?}"); let description = Matcher::::describe(self, self.matches(actual)); let diff = if is_multiline_string_debug(&actual_debug) diff --git a/googletest/tests/colorized_diff_test.rs b/googletest/tests/colorized_diff_test.rs index b824afaf..98d575b5 100644 --- a/googletest/tests/colorized_diff_test.rs +++ b/googletest/tests/colorized_diff_test.rs @@ -22,7 +22,7 @@ fn build_text(mut collection: impl Iterator) -> String { write!(&mut text, "{}", collection.next().expect("Provided collection without elements")) .unwrap(); for item in collection { - write!(&mut text, "\n{}", item).unwrap(); + write!(&mut text, "\n{item}").unwrap(); } text } diff --git a/googletest/tests/no_color_test.rs b/googletest/tests/no_color_test.rs index 5773d41f..081a335f 100644 --- a/googletest/tests/no_color_test.rs +++ b/googletest/tests/no_color_test.rs @@ -22,7 +22,7 @@ fn build_text(mut collection: impl Iterator) -> String { write!(&mut text, "{}", collection.next().expect("Provided collection without elements")) .unwrap(); for item in collection { - write!(&mut text, "\n{}", item).unwrap(); + write!(&mut text, "\n{item}").unwrap(); } text } diff --git a/integration_tests/src/failure_due_to_returned_error_with_line_numbers.rs b/integration_tests/src/failure_due_to_returned_error_with_line_numbers.rs index 3dd067bc..eebe2be8 100644 --- a/integration_tests/src/failure_due_to_returned_error_with_line_numbers.rs +++ b/integration_tests/src/failure_due_to_returned_error_with_line_numbers.rs @@ -24,7 +24,7 @@ mod tests { impl std::fmt::Display for FakeError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self) + write!(f, "{self:?}") } } impl std::error::Error for FakeError {}