Warn on the presence of unnecessary wildcards in output positions

This commit is contained in:
Ayaz Hafiz 2022-10-26 10:49:19 -05:00
parent d55dbbf0ae
commit cfe7c8e5ef
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
17 changed files with 151 additions and 106 deletions

View file

@ -1015,6 +1015,15 @@ pub fn can_problem<'b>(
title = "OVERLOADED SPECIALIZATION".to_string();
severity = Severity::Warning;
}
Problem::UnnecessaryOutputWildcard { region } => {
doc = alloc.stack([
alloc.reflow("I see you annotated a wildcard in a place where it's not needed:"),
alloc.region(lines.convert_region(region)),
alloc.reflow("Tag unions that are constants, or the return values of functions, are always inferred to be open by default! You can remove this annotation safely."),
]);
title = "UNNECESSARY WILDCARD".to_string();
severity = Severity::Warning;
}
};
Report {