diff options
| author | Georg Brandl <georg@python.org> | 2016-05-01 22:12:48 +0200 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2016-05-02 06:10:10 +0200 |
| commit | 0e89f55982bea0597b52eee75071caf0e686a449 (patch) | |
| tree | 99d6549fbdc387fdb1d67b1c73a18a305546d56d | |
| parent | 2a815a26c8ce70e1aede585827c020d9775a8faf (diff) | |
E0269: add suggestion to check for trailing semicolons
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: #30497
| -rw-r--r-- | src/librustc/diagnostics.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index e230836ef45..448cdc71af7 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -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##" |
