mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 04:55:22 +03:00
25 lines
490 B
Rust
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
|
|
}
|