fix: use map func to avoid copy of string

This commit is contained in:
wgdzlh
2022-07-05 18:08:24 +08:00
parent 3834b8dd52
commit 1d510fadc9
3 changed files with 3 additions and 3 deletions

View File

@ -127,7 +127,7 @@ fn main() {
check_size([0u8; 767]);
check_size([0i32; 191]);
check_size(["hello你好"; __]); // Size of &str ?
check_size(["hello你好".to_string(); __]); // Size of String?
check_size([(); __].map(|_| "hello你好".to_string())); // Size of String?
check_size(['中'; __]); // Size of char ?
println!("Success!");