Skip to content

Commit

Permalink
Fix clippy lint suggestion incorrectly treated as span_help
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Jul 18, 2024
1 parent 90baa6a commit fcaa2c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/tools/clippy/clippy_lints/src/unnecessary_wraps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryWraps {
(
"this function's return value is unnecessary".to_string(),
"remove the return type...".to_string(),
snippet(cx, fn_decl.output.span(), "..").to_string(),
// FIXME: we should instead get the span including the `->` and suggest an
// empty string for this case.
"()".to_string(),
"...and then remove returned values",
)
} else {
Expand Down
8 changes: 8 additions & 0 deletions src/tools/clippy/tests/ui/unnecessary_wraps.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ LL | | }
LL | | }
| |_^
|
help: remove the return type...
|
LL | fn issue_6640_1(a: bool, b: bool) -> () {
| ~~
help: ...and then remove returned values
|
LL ~ return ;
Expand All @@ -139,6 +143,10 @@ LL | | }
LL | | }
| |_^
|
help: remove the return type...
|
LL | fn issue_6640_2(a: bool, b: bool) -> () {
| ~~
help: ...and then remove returned values
|
LL ~ return ;
Expand Down

0 comments on commit fcaa2c4

Please sign in to comment.