Skip to content

Commit 85fa395

Browse files
committed
remove unnecessary match
1 parent 855035b commit 85fa395

File tree

1 file changed

+9
-20
lines changed
  • compiler/rustc_hir_typeck/src/fn_ctxt

1 file changed

+9
-20
lines changed

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

+9-20
Original file line numberDiff line numberDiff line change
@@ -1318,27 +1318,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13181318
infer_args: bool,
13191319
) -> ty::GenericArg<'tcx> {
13201320
let tcx = self.fcx.tcx();
1321-
match param.kind {
1322-
GenericParamDefKind::Lifetime => self
1323-
.fcx
1324-
.re_infer(
1325-
self.span,
1326-
rustc_hir_analysis::hir_ty_lowering::RegionInferReason::Param(param),
1327-
)
1328-
.into(),
1329-
GenericParamDefKind::Type { .. } | GenericParamDefKind::Const { .. } => {
1330-
if !infer_args && let Some(default) = param.default_value(tcx) {
1331-
// If we have a default, then it doesn't matter that we're not inferring
1332-
// the type/const arguments: We provide the default where any is missing.
1333-
return default.instantiate(tcx, preceding_args);
1334-
}
1335-
// If no type/const arguments were provided, we have to infer them.
1336-
// This case also occurs as a result of some malformed input, e.g.,
1337-
// a lifetime argument being given instead of a type/const parameter.
1338-
// Using inference instead of `Error` gives better error messages.
1339-
self.fcx.var_for_def(self.span, param)
1340-
}
1321+
if !infer_args && let Some(default) = param.default_value(tcx) {
1322+
// If we have a default, then it doesn't matter that we're not inferring
1323+
// the type/const arguments: We provide the default where any is missing.
1324+
return default.instantiate(tcx, preceding_args);
13411325
}
1326+
// If no type/const arguments were provided, we have to infer them.
1327+
// This case also occurs as a result of some malformed input, e.g.,
1328+
// a lifetime argument being given instead of a type/const parameter.
1329+
// Using inference instead of `Error` gives better error messages.
1330+
self.fcx.var_for_def(self.span, param)
13421331
}
13431332
}
13441333

0 commit comments

Comments
 (0)