|
I might be asking something bad or not idk but when I was doing the conversion5.rs exercise, the testcase on the sqrt case for the usage of the AsMut trait, it looks like this #[test]
fn mut_box() {
let mut num: Box<u32> = Box::new(3);
num_sq(&mut num);
assert_eq!(*num, 9);
// ^^^^ -> this is referencing the box value instead of the num_sq value
}
}but should it have the squared value instead of the previous value? i did this change and it worked #[test]
fn mut_box() {
let mut num: Box<u32> = Box::new(3);
assert_eq!(num_sq(&mut num), 9);
}
} |
Answered by
iberniex
Aug 19, 2026
Replies: 1 comment
|
Oh never mind. I got lost in the sauce. you dereference the argument and then you do the compound multiplication assignment operation. My bad :-P |
0 replies
Answer selected by
iberniex
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oh never mind. I got lost in the sauce. you dereference the argument and then you do the compound multiplication assignment operation. My bad :-P