Skip to content

Commit 3416d59

Browse files
authored
Avoid unnecessary borrow in exercise.rs (#3026)
We haven't talked about copy types yet, but the rows are infact `Copy`. So we can avoid the borrow syntax, which hasn't yet been introduced. Also inline the variable in the format string like elsewhere in the course.
1 parent 08b984b commit 3416d59

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/tuples-and-arrays/exercise.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ fn main() {
3636
];
3737

3838
println!("Original:");
39-
for row in &matrix {
40-
println!("{:?}", row);
39+
for row in matrix {
40+
println!("{row:?}");
4141
}
4242

4343
let transposed = transpose(matrix);
4444

4545
println!("\nTransposed:");
46-
for row in &transposed {
47-
println!("{:?}", row);
46+
for row in transposed {
47+
println!("{row:?}");
4848
}
4949
}
5050
// ANCHOR_END: main

0 commit comments

Comments
 (0)