mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-06-22 20:19:42 +00:00
Merge pull request #547 from msuganthan/patch-1
use ref instead of clone
This commit is contained in:
@ -163,7 +163,7 @@ fn main() {
|
||||
let t = (String::from("hello"), String::from("world"));
|
||||
|
||||
// fill the blanks
|
||||
let (s1, s2) = t.clone();
|
||||
let (ref s1, ref s2) = t;
|
||||
|
||||
println!("{:?}, {:?}, {:?}", s1, s2, t); // -> "hello", "world", ("hello", "world")
|
||||
}
|
||||
|
Reference in New Issue
Block a user