Replace flat_map() with filter_map() in is_useful_specialized().
`filter_map()` is less general, but more efficient, and has the same effect in this case. This commit reduces the instruction count for `unicode_normalization-check-clean` by about 2%.
This commit is contained in:
parent
5515a97646
commit
2a3a544741
1 changed files with 5 additions and 3 deletions
|
|
@ -1355,9 +1355,11 @@ fn is_useful_specialized<'p, 'a, 'tcx>(
|
|||
}
|
||||
}).collect();
|
||||
let wild_patterns: Vec<_> = wild_patterns_owned.iter().collect();
|
||||
let matrix = Matrix(m.iter().flat_map(|r| {
|
||||
specialize(cx, &r, &ctor, &wild_patterns)
|
||||
}).collect());
|
||||
let matrix = Matrix(
|
||||
m.iter()
|
||||
.filter_map(|r| specialize(cx, &r, &ctor, &wild_patterns))
|
||||
.collect()
|
||||
);
|
||||
match specialize(cx, v, &ctor, &wild_patterns) {
|
||||
Some(v) => match is_useful(cx, &matrix, &v, witness) {
|
||||
UsefulWithWitness(witnesses) => UsefulWithWitness(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue