mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-06-23 04:29:41 +00:00
fix: use map func to avoid copy of string
This commit is contained in:
@ -123,7 +123,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 ?
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user