]> git.proxmox.com Git - rustc.git/blobdiff - src/tools/clippy/tests/ui/string_add_assign.fixed
Update upstream source from tag 'upstream/1.52.1+dfsg1'
[rustc.git] / src / tools / clippy / tests / ui / string_add_assign.fixed
diff --git a/src/tools/clippy/tests/ui/string_add_assign.fixed b/src/tools/clippy/tests/ui/string_add_assign.fixed
new file mode 100644 (file)
index 0000000..db71bab
--- /dev/null
@@ -0,0 +1,21 @@
+// run-rustfix
+
+#[allow(clippy::string_add, unused)]
+#[warn(clippy::string_add_assign)]
+fn main() {
+    // ignores assignment distinction
+    let mut x = "".to_owned();
+
+    for _ in 1..3 {
+        x += ".";
+    }
+
+    let y = "".to_owned();
+    let z = y + "...";
+
+    assert_eq!(&x, &z);
+
+    let mut x = 1;
+    x += 1;
+    assert_eq!(2, x);
+}