1
Fork 0

Account for impl Trait in "add bound" suggestion message

This commit is contained in:
Esteban Küber 2024-11-28 22:20:44 +00:00
parent d860e5b088
commit cb4db0a6c6
5 changed files with 10 additions and 4 deletions

View file

@ -531,6 +531,12 @@ pub fn suggest_constraining_type_params<'a>(
SuggestChangingConstraintsMessage::RestrictBoundFurther => {
format!("consider further restricting this bound with {post}")
}
SuggestChangingConstraintsMessage::RestrictTypeFurther { ty }
| SuggestChangingConstraintsMessage::RestrictType { ty }
if ty.starts_with("impl ") =>
{
format!("consider restricting opaque type `{ty}` with {post}")
}
SuggestChangingConstraintsMessage::RestrictType { ty } => {
format!("consider restricting type parameter `{ty}` with {post}")
}