Okay, this question sounds a bit crazy. Hopefully you can at least understand why I am asking.
Even in the first example in the Rust book we come across trying to parse a number from a string like so:
let guess: u32 = guess.trim().parse()
.expect("Please type a number!");
And I often find myself doing similar things. However, when this fails the error doesn't really tell me anything about the problem. I can go back in to add debugging but I will at least have to do something like:
let word = guess.trim();
let guess: u32 = word.parse()
.expect(&format!("Failed to parse \"{}\" as an integer.", word));
Note that I had to introduce an extra variable to capture the input of the call that returns the Option or Result. I was wondering if there is any shorthand for getting a slightly more descriptive error message, possibly showing the input, without manually writing it out.