Add note about lack of a guard in missing tag

This commit is contained in:
ayazhafiz 2022-03-05 13:34:49 -05:00
parent 81481e2599
commit cc07c93fc3
2 changed files with 5 additions and 2 deletions

View file

@ -167,7 +167,8 @@ fn pattern_to_doc_help<'b>(
TagName::Global("#Guard".into())
);
debug_assert!(args.len() == 2);
pattern_to_doc_help(alloc, args[1].clone(), in_type_param)
let tag = pattern_to_doc_help(alloc, args[1].clone(), in_type_param);
tag.append(" (note the lack of a guard)")
}
RenderAs::Record(field_names) => {
let mut arg_docs = Vec::with_capacity(args.len());

View file

@ -8486,6 +8486,8 @@ I need all branches in an `if` to have the same type!
),
)
}
#[test]
fn non_exhaustive_with_guard() {
report_problem_as(
indoc!(
@ -8506,7 +8508,7 @@ I need all branches in an `if` to have the same type!
Other possibilities include:
A
A (note the lack of a guard)
I would have to crash if I saw one of those! Add branches for them!
"#