Skip to content

Comment on Writing a minimal Lua implementation with a virtual machine from scratch in Rustparent

Comments

That is not how Rust documents expect() should be used. Rust's own documentation (https://doc.rust-lang.org/std/result/) contains:

  let mut file = File::create("valuable_data.txt").unwrap();
  file.write_all(b"important message").expect("failed to write message");
The use of .expect("Could not read file") is consistent with Rust's documentation.

And I agree with OP that .expect() is poorly named. I wouldn't raise it as an issue on the work of others who just use Rust and are stuck with it though.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.