News for hackers. Stuff that matters.
Re:Rust web framework, Iron by codingbinary on Sunday August 16, 2015 @06:19PM (#10070475)
Because hello_world returns an IronResult, which in turn is just a simple Result type from Rust. Note that the status::Ok is different from the Ok(...).

Iron::new expects a function that returns a Result type, so it has to be there.

Re:Rust web framework, Iron by slimsag on Sunday August 16, 2015 @06:21PM (#10070480)
Also, because it is a Result it forces the caller to either handle the error or explicitly panic on it, right? They can't ignore it? (which is awesome!)
Re:Rust web framework, Iron by Manishearth on Sunday August 16, 2015 @08:21PM (#10070809)
Yes, because it is a Result, the caller cannot access the success value without acknowledging the existence of an error -- via match , unwrap, or try.

If the caller does not want to use the success value (esp. in cases which return Result<(),E>, i.e. return an optional error), there is a lint which tries to ensure that the error value is handled, though as steve says you can circumvent it (which is done in an explicit way so that it's pretty obvious that there is an error being ignored).

Re:Rust web framework, Iron by steveklabnik on Sunday August 16, 2015 @06:58PM (#10070588)
They could do something like

    let _ = something_returning_result()
But without the let, there's a warning. And culturally speaking, let _ is discouraged for this reason. If I want to ignore an error condition, I unwrap() instead, so at least my dumb decision will blow up in my face later instead of faint silently.
Re:Rust web framework, Iron by Manishearth on Sunday August 16, 2015 @08:18PM (#10070803)
I think they were talking about the compiler-enforced exhaustive match, not must_use.

The fact that you must acknowledge the existence of the error value before accessing the meaty success value (either with a match, an unwrap, or a try) is a great feature in Rust.

must_use forcing you to handle errors for things you don't need the meaty success value of is just icing on the cake.