Skip to content

Commit b988efc

Browse files
committed
Remove an unnecessary unwrap
1 parent f42f19b commit b988efc

File tree

1 file changed

+4
-8
lines changed
  • compiler/rustc_hir_typeck/src/fn_ctxt

1 file changed

+4
-8
lines changed

compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
9393
tuple_arguments: TupleArgumentsFlag,
9494
expected: Expectation<'tcx>,
9595
) -> Ty<'tcx> {
96-
let has_error = match method {
97-
Ok(method) => method.substs.references_error() || method.sig.references_error(),
98-
Err(_) => true,
99-
};
100-
if has_error {
96+
let method = method.ok().filter(|method| !method.references_error());
97+
let Some(method) = method else {
10198
let err_inputs = self.err_args(args_no_rcvr.len());
10299

103100
let err_inputs = match tuple_arguments {
@@ -113,12 +110,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
113110
args_no_rcvr,
114111
false,
115112
tuple_arguments,
116-
method.ok().map(|method| method.def_id),
113+
method.map(|method| method.def_id),
117114
);
118115
return self.tcx.ty_error_misc();
119-
}
116+
};
120117

121-
let method = method.unwrap();
122118
// HACK(eddyb) ignore self in the definition (see above).
123119
let expected_input_tys = self.expected_inputs_for_expected_output(
124120
sp,

0 commit comments

Comments
 (0)