Files
rust/tests/ui/str_to_string.fixed
T
2026-01-07 19:00:22 +00:00

25 lines
490 B
Rust

#![warn(clippy::str_to_string)]
fn main() {
let hello = "hello world".to_owned();
//~^ str_to_string
let msg = &hello[..];
msg.to_owned();
//~^ str_to_string
}
fn issue16271(key: &[u8]) {
macro_rules! t {
($e:expr) => {
match $e {
Ok(e) => e,
Err(e) => panic!("{} failed with {}", stringify!($e), e),
}
};
}
let _value = t!(str::from_utf8(key)).to_owned();
//~^ str_to_string
}