Improve error message
This commit is contained in:
parent
abdb7aeb55
commit
f359fb872b
@ -3883,8 +3883,8 @@ fn lint_from_iter(cx: &LateContext<'_>, expr: &hir::Expr<'_>, args: &[hir::Expr<
|
||||
cx,
|
||||
FROM_ITER_INSTEAD_OF_COLLECT,
|
||||
expr.span,
|
||||
"usage of `FromIterator::from_iter`",
|
||||
"use `.collect()` instead of `::from_iter()`",
|
||||
"consider using",
|
||||
format!("{}.collect()", iter_expr),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
|
@ -1,16 +1,16 @@
|
||||
error: use `.collect()` instead of `::from_iter()`
|
||||
error: usage of `FromIterator::from_iter`
|
||||
--> $DIR/from_iter_instead_of_collect.rs:8:5
|
||||
|
|
||||
LL | Vec::from_iter(iter_expr);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `iter_expr.collect()`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `.collect()` instead of `::from_iter()`: `iter_expr.collect()`
|
||||
|
|
||||
= note: `-D clippy::from-iter-instead-of-collect` implied by `-D warnings`
|
||||
|
||||
error: use `.collect()` instead of `::from_iter()`
|
||||
error: usage of `FromIterator::from_iter`
|
||||
--> $DIR/from_iter_instead_of_collect.rs:10:5
|
||||
|
|
||||
LL | HashMap::<usize, &i8>::from_iter(vec![5, 5, 5, 5].iter().enumerate());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `vec![5, 5, 5, 5].iter().enumerate().collect()`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `.collect()` instead of `::from_iter()`: `vec![5, 5, 5, 5].iter().enumerate().collect()`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user