Rollup merge of #92022 - woodenarrow:br_expected_bool, r=estebank

Eliminate duplicate codes of expected_found_bool

The function expected_found_bool is the same as ExpectedFound::new. So use ExpectedFound::new to replace expected_found_bool to eliminate duplicate codes.

![image](https://user-images.githubusercontent.com/95843988/146486722-c910eccd-a36c-4dc5-8b36-214aab058e38.png)
This commit is contained in:
Matthias Krüger
2021-12-18 11:28:06 +01:00
committed by GitHub
3 changed files with 7 additions and 15 deletions

View File

@@ -836,13 +836,5 @@ pub fn expected_found<R, T>(relation: &mut R, a: T, b: T) -> ExpectedFound<T>
where
R: TypeRelation<'tcx>,
{
expected_found_bool(relation.a_is_expected(), a, b)
}
pub fn expected_found_bool<T>(a_is_expected: bool, a: T, b: T) -> ExpectedFound<T> {
if a_is_expected {
ExpectedFound { expected: a, found: b }
} else {
ExpectedFound { expected: b, found: a }
}
ExpectedFound::new(relation.a_is_expected(), a, b)
}