remove unreachable! in favor of debug_assert!(false);

This commit is contained in:
Sébastien Besnier 2020-11-26 08:37:09 +01:00
parent a55d755108
commit b0a8e96d34

View file

@ -331,10 +331,10 @@ impl<'a> Formattable<'a> for TypeAnnotation<'a> {
SpaceAfter(ann, spaces) => { SpaceAfter(ann, spaces) => {
ann.format_with_options(buf, parens, newlines, indent); ann.format_with_options(buf, parens, newlines, indent);
fmt_comments_only(buf, spaces.iter(), NewlineAt::Bottom, indent); fmt_comments_only(buf, spaces.iter(), NewlineAt::Bottom, indent);
// seems like a lot of spaceAfter are not constructible // seems like this SpaceAfter is not constructible
// since most of the time we use "SpaceBefore". // so this branch hasn't be tested. Please add some test if
// Is this specific case really unreachable? // this branch is actually reached and remove this dbg_assert.
unreachable!("cannot have space after type annotation"); debug_assert!(false);
} }
Malformed(raw) => buf.push_str(raw), Malformed(raw) => buf.push_str(raw),