Skip to content

Commit f359fb8

Browse files
pitiK3Uflip1995
authored andcommitted
Improve error message
1 parent abdb7ae commit f359fb8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

clippy_lints/src/methods/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3883,8 +3883,8 @@ fn lint_from_iter(cx: &LateContext<'_>, expr: &hir::Expr<'_>, args: &[hir::Expr<
38833883
cx,
38843884
FROM_ITER_INSTEAD_OF_COLLECT,
38853885
expr.span,
3886+
"usage of `FromIterator::from_iter`",
38863887
"use `.collect()` instead of `::from_iter()`",
3887-
"consider using",
38883888
format!("{}.collect()", iter_expr),
38893889
Applicability::MaybeIncorrect,
38903890
);
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
error: use `.collect()` instead of `::from_iter()`
1+
error: usage of `FromIterator::from_iter`
22
--> $DIR/from_iter_instead_of_collect.rs:8:5
33
|
44
LL | Vec::from_iter(iter_expr);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `iter_expr.collect()`
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `.collect()` instead of `::from_iter()`: `iter_expr.collect()`
66
|
77
= note: `-D clippy::from-iter-instead-of-collect` implied by `-D warnings`
88

9-
error: use `.collect()` instead of `::from_iter()`
9+
error: usage of `FromIterator::from_iter`
1010
--> $DIR/from_iter_instead_of_collect.rs:10:5
1111
|
1212
LL | HashMap::<usize, &i8>::from_iter(vec![5, 5, 5, 5].iter().enumerate());
13-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `vec![5, 5, 5, 5].iter().enumerate().collect()`
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `.collect()` instead of `::from_iter()`: `vec![5, 5, 5, 5].iter().enumerate().collect()`
1414

1515
error: aborting due to 2 previous errors
1616

0 commit comments

Comments
 (0)