3 ms·
it is intended to be read as “expect this to work”, or “expect this isn’t an error”
by sezna 6y ago
it is intended to be read as “expect this to work”, or “expect this isn’t an error”
- einpoklum 6y agoBut the argument is an error message, so it's not "expect this to work"...
- azdle 6y agoThat's technically the second argument. Just like in C++, when using a chained method, the first argument is implied to be the thing you're chaining on. So this is the same thing as calling Result::expect(File::open(&input_filename), "[ ERROR ] Failed to open file!"), but I've never actually seen someone ever use expect that way. See also the definition of expect: https://doc.rust-lang.org/std/result/enum.Result.html#method.expect https://doc.rust-lang.org/std/result/enum.Result.html#method...