Skip to content

Commit e320dd3

Browse files
pitiK3Uflip1995
authored andcommitted
Improve: error message
1 parent 0ab96ba commit e320dd3

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

clippy_lints/src/utils/paths.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub const FN: [&str; 3] = ["core", "ops", "Fn"];
4444
pub const FN_MUT: [&str; 3] = ["core", "ops", "FnMut"];
4545
pub const FN_ONCE: [&str; 3] = ["core", "ops", "FnOnce"];
4646
pub const FROM_FROM: [&str; 4] = ["core", "convert", "From", "from"];
47-
pub const FROM_ITERATOR: [&str; 3] = ["std", "iter", "FromIterator"];
47+
pub const FROM_ITERATOR: [&str; 5] = ["core", "iter", "traits", "collect", "FromIterator"];
4848
pub const FROM_TRAIT: [&str; 3] = ["core", "convert", "From"];
4949
pub const FUTURE_FROM_GENERATOR: [&str; 3] = ["core", "future", "from_generator"];
5050
pub const HASH: [&str; 3] = ["core", "hash", "Hash"];

tests/ui/from_iter_instead_of_collect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::iter::FromIterator;
55

66
fn main() {
77
let iter_expr = std::iter::repeat(5).take(5);
8-
98
Vec::from_iter(iter_expr);
9+
1010
HashMap::<usize, &i8>::from_iter(vec![5, 5, 5, 5].iter().enumerate());
1111
}

tests/ui/from_iter_instead_of_collect.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: use `.collect()` instead of `::from_iter()`
2-
--> $DIR/from_iter_instead_of_collect.rs:9:5
2+
--> $DIR/from_iter_instead_of_collect.rs:8:5
33
|
44
LL | Vec::from_iter(iter_expr);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: ``iter_expr.collect()``

0 commit comments

Comments
 (0)