missing_transmute_annotations: handle pattern_types in suggestion - #17613
missing_transmute_annotations: handle pattern_types in suggestion#17613GTimothy wants to merge 2 commits into
missing_transmute_annotations: handle pattern_types in suggestion#17613Conversation
| /// Tries to render a `ty::Pat` type as a valid `pattern_type!(...)` macro invocation, | ||
| fn try_format_pat_ty(ty: Ty<'_>) -> Option<String> { | ||
| let ty::Pat(base, pat) = ty.kind() else { return None }; | ||
| if matches!(base.kind(), ty::Pat(..)) { |
There was a problem hiding this comment.
Is this right, or should I just return None here?
|
Hm, I think the usual expectation is that the |
Ok, I will thanks |
transmute_missing_annotationsdoes not suggest valid rust code forpattern_types. For instance, a range pattern_type likepattern_type!(u8 is 1..)gets suggested as((u8) is 1..).This PR addresses this issue.
It also gates the suggestion itself on the
pattern_typefeature being enabled to avoid suggesting code that cannot compile without it.changelog:[
transmute_missing_annotations]: handle pattern_types in suggestion