Skip to content

Commit 49bc1a1

Browse files
committed
Fix clippy lint suggestion incorrectly treated as span_help
1 parent 5264109 commit 49bc1a1

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/tools/clippy/clippy_lints/src/unnecessary_wraps.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryWraps {
145145
(
146146
"this function's return value is unnecessary".to_string(),
147147
"remove the return type...".to_string(),
148-
snippet(cx, fn_decl.output.span(), "..").to_string(),
148+
// FIXME: we should instead get the span including the `->` and suggest an
149+
// empty string for this case.
150+
"()".to_string(),
149151
"...and then remove returned values",
150152
)
151153
} else {

src/tools/clippy/tests/ui/unnecessary_wraps.stderr

+8
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ LL | | }
116116
LL | | }
117117
| |_^
118118
|
119+
help: remove the return type...
120+
|
121+
LL | fn issue_6640_1(a: bool, b: bool) -> () {
122+
| ~~
119123
help: ...and then remove returned values
120124
|
121125
LL ~ return ;
@@ -139,6 +143,10 @@ LL | | }
139143
LL | | }
140144
| |_^
141145
|
146+
help: remove the return type...
147+
|
148+
LL | fn issue_6640_2(a: bool, b: bool) -> () {
149+
| ~~
142150
help: ...and then remove returned values
143151
|
144152
LL ~ return ;

0 commit comments

Comments
 (0)