]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/format.rs
Auto merge of #68717 - petrochenkov:stabexpat, r=varkor
[rust.git] / tests / ui / format.rs
index 61ef3e7243d794eda5987b92e2c9c55c7232c626..b604d79cca373119935232370d9cee658c540f5c 100644 (file)
@@ -1,6 +1,6 @@
 // run-rustfix
 
-#![allow(clippy::print_literal)]
+#![allow(clippy::print_literal, clippy::redundant_clone)]
 #![warn(clippy::useless_format)]
 
 struct Foo(pub String);
@@ -13,6 +13,10 @@ fn main() {
     format!("foo");
     format!("{{}}");
     format!("{{}} abc {{}}");
+    format!(
+        r##"foo {{}}
+" bar"##
+    );
 
     format!("{}", "foo");
     format!("{:?}", "foo"); // Don't warn about `Debug`.
@@ -59,4 +63,8 @@ fn main() {
     format!("{}", 42.to_string());
     let x = std::path::PathBuf::from("/bar/foo/qux");
     format!("{}", x.display().to_string());
+
+    // False positive
+    let a = "foo".to_string();
+    let _ = Some(format!("{}", a + "bar"));
 }