Skip to content

Commit

Permalink
E0269: add suggestion to check for trailing semicolons
Browse files Browse the repository at this point in the history
In situations where the value of the last expression must be inferred,
rustc will not emit the "you might need to remove the semicolon" warning,
so at least note this in the extended description.

Fixes: rust-lang#30497
  • Loading branch information
birkenfeld committed May 2, 2016
1 parent 2a815a2 commit 0e89f55
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/librustc/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,17 @@ fn foo(x: u8) -> u8 {
```
It is advisable to find out what the unhandled cases are and check for them,
returning an appropriate value or panicking if necessary.
returning an appropriate value or panicking if necessary. Check if you need
to remove a semicolon from the last expression, like in this case:
```ignore
fn foo(x: u8) -> u8 {
inner(2*x + 1);
}
```
The semicolon discards the return value of `inner`, instead of returning
it from `foo`.
"##,

E0270: r##"
Expand Down

0 comments on commit 0e89f55

Please sign in to comment.