1
Fork 0

Improve: error message

This commit is contained in:
Piti the little Light 2020-10-01 18:34:36 +02:00 committed by flip1995
parent 0ab96ba2c0
commit e320dd3042
No known key found for this signature in database
GPG key ID: AFC0354489087877
3 changed files with 3 additions and 3 deletions

View file

@ -44,7 +44,7 @@ pub const FN: [&str; 3] = ["core", "ops", "Fn"];
pub const FN_MUT: [&str; 3] = ["core", "ops", "FnMut"];
pub const FN_ONCE: [&str; 3] = ["core", "ops", "FnOnce"];
pub const FROM_FROM: [&str; 4] = ["core", "convert", "From", "from"];
pub const FROM_ITERATOR: [&str; 3] = ["std", "iter", "FromIterator"];
pub const FROM_ITERATOR: [&str; 5] = ["core", "iter", "traits", "collect", "FromIterator"];
pub const FROM_TRAIT: [&str; 3] = ["core", "convert", "From"];
pub const FUTURE_FROM_GENERATOR: [&str; 3] = ["core", "future", "from_generator"];
pub const HASH: [&str; 3] = ["core", "hash", "Hash"];

View file

@ -5,7 +5,7 @@ use std::iter::FromIterator;
fn main() {
let iter_expr = std::iter::repeat(5).take(5);
Vec::from_iter(iter_expr);
HashMap::<usize, &i8>::from_iter(vec![5, 5, 5, 5].iter().enumerate());
}

View file

@ -1,5 +1,5 @@
error: use `.collect()` instead of `::from_iter()`
--> $DIR/from_iter_instead_of_collect.rs:9:5
--> $DIR/from_iter_instead_of_collect.rs:8:5
|
LL | Vec::from_iter(iter_expr);
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: ``iter_expr.collect()``