Here the compiler complains about the for loop but the problem is that no value is being returned to the function call. This error is confusing.
fn read() -> Vec<String> {
let data: Vec<String> = Vec::new();
for _ in range(0i, 7i) {}
//data
}
fn main() {
read();
}
Returns:
<anon>:3:5: 5:2 error: mismatched types: expected `collections::vec::Vec<collections::string::String>`, found `()` (expected struct collections::vec::Vec, found ())
<anon>:3 for _ in range(0i, 7i) {}
<anon>:4 //data
<anon>:5 }
error: aborting due to previous error
playpen: application terminated with error code 101
Here the compiler complains about the
forloop but the problem is that no value is being returned to the function call. This error is confusing.Returns: