Update on rust-toys
With the release of rust 1.0.0-beta, I've received a ping about updating my code from 0.11. Unfortunately, I hit the following:
let line : String = line.unwrap();
let line : &str = line.as_str().trim();
The variable line coming in is a io::Result Unfortunately, that code fails to compile with: And the convert feature is not allowed in the beta release channel. (There was a fix for the error message suggestion, to prevent the compiler from showing "add #![feature..." when that won't work, but it didn't make it into the beta release. I'm going to bail on this for the moment, until the standard library settles down a bit. I realized I hadn't tried one thing: calling trim() on the String itself. It works. I don't know how. Later. Hah. Because there is a Str implementation for String. I think. As I recall, there wasn't previously, which was why I needed to get the str explicitly.
src/bin/mk_anadict.rs:18:32: 18:40 error: use of unstable library feature 'convert': waiting on RFC revision
src/bin/mk_anadict.rs:18 let line : &str = line.as_str().trim();
^~~~~~~~
src/bin/mk_anadict.rs:18:40: 18:40 help: add #![feature(convert)] to the crate attributes to enablePS. Wait, what?
let line : String = line.unwrap();
let line : &str = line.trim();