Closed
Description
rustc 1.51.0 (2fd73fabe 2021-03-23)
rustc 1.53.0-nightly (07e0e2ec2 2021-03-24)
Docstrings placed at a few selected positions that cause either a warning (good
), an unrelated error (bad
) or both (ugly
).
fn good(num: u8) -> bool {
match num {
3 => true,
/// warning: unused doc comment
_ => false,
}
}
fn bad(num: u8) -> bool {
if num == 3 {
true
}
/// error[E0308]: mismatched types
/// error: expected expression, found keyword `else`
else {
false
}
}
fn ugly(num: u8) -> bool {
/// error[E0658]: attributes on expressions are experimental
/// warning: unused doc comment
num == 3
}
On the third example we at least get an additional warning to point us in the right direction.
The second example can become nightmare to catch :3