about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorPhilipp Krones <hello@philkrones.com>2024-12-16 16:22:27 +0000
committerGitHub <noreply@github.com>2024-12-16 16:22:27 +0000
commit77c9dddecb91e2642ff57837a4e77b51e4c3ea63 (patch)
treee9fb031f989e95c4b60612ba78a69714419d6952 /tests
parent063c5c17433ff058d7c899d2933f2c7d1162b3da (diff)
parentad695da7d2c1d9c01f08a5be84ccff02df70eb68 (diff)
downloadrust-77c9dddecb91e2642ff57837a4e77b51e4c3ea63.tar.gz
rust-77c9dddecb91e2642ff57837a4e77b51e4c3ea63.zip
Correctly handle string indices in `literal_string_with_formatting_arg` (#13841)
Fixes https://github.com/rust-lang/rust-clippy/issues/13838.

r? @klensy

changelog: Correctly handle string indices in
`literal_string_with_formatting_arg`
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/literal_string_with_formatting_arg.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/ui/literal_string_with_formatting_arg.rs b/tests/ui/literal_string_with_formatting_arg.rs
index 20bd243aa30..f257c66f59d 100644
--- a/tests/ui/literal_string_with_formatting_arg.rs
+++ b/tests/ui/literal_string_with_formatting_arg.rs
@@ -30,4 +30,8 @@ fn main() {
     }";
     // Unicode characters escape should not lint either.
     "\u{0052}".to_string();
+
+    // Regression test for <https://github.com/rust-lang/rust-clippy/issues/13838>.
+    let x: Option<usize> = Some(0);
+    x.expect("{…}");
 }