mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
17 lines
385 B
Rust
17 lines
385 B
Rust
#![warn(clippy::string_from_utf8_as_bytes)]
|
|
|
|
macro_rules! test_range {
|
|
($start:expr, $end:expr) => {
|
|
$start..$end
|
|
};
|
|
}
|
|
|
|
fn main() {
|
|
let _ = std::str::from_utf8(&"Hello World!".as_bytes()[6..11]);
|
|
//~^ string_from_utf8_as_bytes
|
|
|
|
let s = "Hello World!";
|
|
let _ = std::str::from_utf8(&s.as_bytes()[test_range!(6, 11)]);
|
|
//~^ string_from_utf8_as_bytes
|
|
}
|