@@ -1217,7 +1217,7 @@ For example:
1217
1217
```compile_fail,E0284
1218
1218
fn foo() -> Result<bool, ()> {
1219
1219
let results = [Ok(true), Ok(false), Err(())].iter().cloned();
1220
- let v : Vec<bool> = results.collect()?;
1220
+ let v: Vec<bool> = results.collect()?;
1221
1221
// Do things with v...
1222
1222
Ok(true)
1223
1223
}
@@ -1228,7 +1228,7 @@ Hence, `results.collect()` can return any type implementing
1228
1228
`FromIterator<Result<bool, ()>>`. On the other hand, the
1229
1229
`?` operator can accept any type implementing `Try`.
1230
1230
1231
- The user of this code probably wants `collect()` to return a
1231
+ The author of this code probably wants `collect()` to return a
1232
1232
`Result<Vec<bool>, ()>`, but the compiler can't be sure
1233
1233
that there isn't another type `T` implementing both `Try` and
1234
1234
`FromIterator<Result<bool, ()>>` in scope such that
@@ -1241,16 +1241,15 @@ To resolve this error, use a concrete type for the intermediate expression:
1241
1241
fn foo() -> Result<bool, ()> {
1242
1242
let results = [Ok(true), Ok(false), Err(())].iter().cloned();
1243
1243
let v = {
1244
- let temp : Result<Vec<bool>, ()> = results.collect();
1244
+ let temp: Result<Vec<bool>, ()> = results.collect();
1245
1245
temp?
1246
1246
};
1247
1247
// Do things with v...
1248
1248
Ok(true)
1249
1249
}
1250
1250
```
1251
- Note that the type of `v` can now be inferred from the type of `temp`
1252
-
1253
1251
1252
+ Note that the type of `v` can now be inferred from the type of `temp`.
1254
1253
"## ,
1255
1254
1256
1255
E0308 : r##"
0 commit comments