Refactor option handling

This commit is contained in:
Jeremy Stucki 2019-09-04 16:19:59 +02:00
parent ffe57fad85
commit 3fc1ec1ffd
No known key found for this signature in database
GPG key ID: EEFCA93148042655
9 changed files with 19 additions and 55 deletions

View file

@ -2797,10 +2797,9 @@ fn get_error_type<'a>(cx: &LateContext<'_, '_>, ty: Ty<'a>) -> Option<Ty<'a>> {
/// This checks whether a given type is known to implement Debug.
fn has_debug_impl<'a, 'b>(ty: Ty<'a>, cx: &LateContext<'b, 'a>) -> bool {
match cx.tcx.get_diagnostic_item(sym::debug_trait) {
Some(debug) => implements_trait(cx, ty, debug, &[]),
None => false,
}
cx.tcx
.get_diagnostic_item(sym::debug_trait)
.map_or(false, |debug| implements_trait(cx, ty, debug, &[]))
}
enum Convention {