rust/tests/ui/string_from_utf8_as_bytes.fixed
2026-01-09 10:37:00 +01:00

16 lines
333 B
Rust

#![warn(clippy::string_from_utf8_as_bytes)]
macro_rules! test_range {
($start:expr, $end:expr) => {
$start..$end
};
}
fn main() {
let _ = Some(&"Hello World!"[6..11]);
//~^ string_from_utf8_as_bytes
let s = "Hello World!";
let _ = Some(&s[test_range!(6, 11)]);
//~^ string_from_utf8_as_bytes
}