"let mut x=10;" has warning! why?


#1

I’m a green hand,please help me.Thanks!
Questions are as follows:

rustc 1.16.0 (30cf806ef 2017-03-10)


#2

This is just a warning, not an error. So your code works. The compiler has some warnings for when you’re doing things that don’t really make sense to do.

Its just telling you that you never actually use the x while it is assigned to 10. You could have just as easily said let x = 20; instead.


#3

Yes, thank you very much!Rust compiler is very powerful!!:wink: