]> git.lizzy.rs Git - rust.git/commit
Simplify `process_obligation`.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 6 Jun 2018 22:31:57 +0000 (08:31 +1000)
committerNicholas Nethercote <nnethercote@mozilla.com>
Thu, 7 Jun 2018 10:25:05 +0000 (20:25 +1000)
commitcdfd9ca08800f7a69fb2a740ac31dbff13b94bce
tree0d1138c259146a95665519c08e346037a619d775
parentc131bdcaff68d35f96e954baac4340206779335f
Simplify `process_obligation`.

`process_predicates` returns a
`Result<Option<Vec<PredicateObligation>>>`. `process_obligation` calls
it and then fiddles with the output (using `map`, `map`, `into_iter`,
`collect`) to produce a a
`Result<Option<Vec<PendingPredicateObligation>>>`.

This function is sufficiently hot that the fiddling is expensive. It's
much better for `process_predicate` to directly return a
`Result<Option<Vec<PendingPredicateObligation>>>` because `Ok(None)`
accounts for ~90% of the results, and `Ok(vec![])` accounts for another
~5%.
src/librustc/traits/fulfill.rs