1
Fork 0

Simplify some places that deal with generic parameter defaults

This commit is contained in:
León Orell Valerian Liehr 2024-11-11 18:41:27 +01:00
parent 143ce0920a
commit d0ddba3d5b
No known key found for this signature in database
GPG key ID: D17A07215F68E713
4 changed files with 39 additions and 115 deletions

View file

@ -86,10 +86,10 @@ impl GenericParamDef {
tcx: TyCtxt<'tcx>,
) -> Option<EarlyBinder<'tcx, ty::GenericArg<'tcx>>> {
match self.kind {
GenericParamDefKind::Type { has_default, .. } if has_default => {
GenericParamDefKind::Type { has_default: true, .. } => {
Some(tcx.type_of(self.def_id).map_bound(|t| t.into()))
}
GenericParamDefKind::Const { has_default, .. } if has_default => {
GenericParamDefKind::Const { has_default: true, .. } => {
Some(tcx.const_param_default(self.def_id).map_bound(|c| c.into()))
}
_ => None,