From e458e1a26c177c9bc2c551ac35542f6a425ee701 Mon Sep 17 00:00:00 2001 From: Hamir Mahal Date: Thu, 26 Dec 2024 11:39:38 -0800 Subject: [PATCH] style: simplify some statements for readability --- examples/hello_world.rs | 2 +- src/common.rs | 2 +- src/lib.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/hello_world.rs b/examples/hello_world.rs index efc4ebf..6c8376c 100644 --- a/examples/hello_world.rs +++ b/examples/hello_world.rs @@ -7,5 +7,5 @@ fn main() { let the_string = "Hello, world!"; clipboard.set_text(the_string).unwrap(); - println!("But now the clipboard text should be: \"{}\"", the_string); + println!("But now the clipboard text should be: \"{the_string}\""); } diff --git a/src/common.rs b/src/common.rs index 291c528..ab00b9c 100644 --- a/src/common.rs +++ b/src/common.rs @@ -85,7 +85,7 @@ impl std::fmt::Debug for Error { ConversionFailure, Unknown { .. } ); - f.write_fmt(format_args!("{} - \"{}\"", name, self)) + f.write_fmt(format_args!("{name} - \"{self}\"")) } } diff --git a/src/lib.rs b/src/lib.rs index ee752f6..01eac45 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -295,7 +295,7 @@ mod tests { match ctx.get_text() { Ok(text) => assert!(text.is_empty()), Err(Error::ContentNotAvailable) => {} - Err(e) => panic!("unexpected error: {}", e), + Err(e) => panic!("unexpected error: {e}"), }; // confirm it is OK to clear when already empty. @@ -310,7 +310,7 @@ mod tests { match ctx.get_text() { Ok(text) => assert!(text.is_empty()), Err(Error::ContentNotAvailable) => {} - Err(e) => panic!("unexpected error: {}", e), + Err(e) => panic!("unexpected error: {e}"), }; } {