Simplify some iterator combinators
This commit is contained in:
parent
c7572670a1
commit
7690fe3bc6
12 changed files with 91 additions and 135 deletions
|
@ -527,26 +527,21 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||
// that are *partially* initialized by assigning to a field of an uninitialized
|
||||
// binding. We differentiate between them for more accurate wording here.
|
||||
"isn't fully initialized"
|
||||
} else if spans
|
||||
.iter()
|
||||
.filter(|i| {
|
||||
// We filter these to avoid misleading wording in cases like the following,
|
||||
// where `x` has an `init`, but it is in the same place we're looking at:
|
||||
// ```
|
||||
// let x;
|
||||
// x += 1;
|
||||
// ```
|
||||
!i.contains(span)
|
||||
} else if !spans.iter().any(|i| {
|
||||
// We filter these to avoid misleading wording in cases like the following,
|
||||
// where `x` has an `init`, but it is in the same place we're looking at:
|
||||
// ```
|
||||
// let x;
|
||||
// x += 1;
|
||||
// ```
|
||||
!i.contains(span)
|
||||
// We filter these to avoid incorrect main message on `match-cfg-fake-edges.rs`
|
||||
&& !visitor
|
||||
.errors
|
||||
.iter()
|
||||
.map(|(sp, _)| *sp)
|
||||
.any(|sp| span < sp && !sp.contains(span))
|
||||
})
|
||||
.count()
|
||||
== 0
|
||||
{
|
||||
}) {
|
||||
show_assign_sugg = true;
|
||||
"isn't initialized"
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue