3 ms·
For example, I've been doing a lot of Rust coding. The code in question looks like: iter.next().ok_or(ErrorKind::NotEnoughArguments.into())?.parse().chain
by iopq 10y ago
For example, I've been doing a lot of Rust coding.
The code in question looks like:
iter.next().ok_or(ErrorKind::NotEnoughArguments.into())?.parse().chain_err(|| "cannot parse argument")?
the compiler responds with cannot infer type information for `_`
the solution is of course to do
iter.next().ok_or::<Error>(ErrorKind::NotEnoughArguments.into())?.parse().chain_err(|| "cannot parse argument")?
then the type inference is decidable
in a dynamic language, you wouldn't have to worry about this; in fact, you wouldn't need to call .into() either - there's just less typing and compiler errors