News for hackers. Stuff that matters.
Re:Rust 1.45 by devit on Thursday July 16, 2020 @03:53PM (#23863145)
Can we please deprecate the "as" operator?

Something so lossy and ill-conceived should not be a two-letter operator.

Re:Rust 1.45 by steveklabnik on Thursday July 16, 2020 @04:12PM (#23863324)
It is possible, someone needs to do the RFC work.

I would say that my personal take of the temperature is "vaguely pro but not a slam dunk", at least from the opinions I've seen. Only one way to find out.

Re:Rust 1.45 by 95th on Friday July 17, 2020 @01:49AM (#23867481)
Then what do you propose for replacement? C++ style casts `(int) x` ?
Re:Rust 1.45 by devit on Friday July 17, 2020 @03:59AM (#23868271)
into()/try_into() and methods designed for each of the other cases (e.g. truncate(), saturating_to_int(), approx_to_float(), etc.)
Re:Rust 1.45 by erk__ on Friday July 17, 2020 @03:07AM (#23867953)
Using `x.into()` instead or `x.try_into()` if it can fail.
Re:Rust 1.45 by stefano_c on Friday July 17, 2020 @05:10AM (#23868694)
What would you suggest for replacing e.g. `u8 as usize`?
Re:Rust 1.45 by steveklabnik on Friday July 17, 2020 @08:12AM (#23869657)
For this one, you could use From/Into, because it cannot fail. For numerics that can fail, TryFrom/TryInto.

The numeric casts are the easy part of this.