Skip to content

Commit fcaa2c4

Browse files
committed
Fix clippy lint suggestion incorrectly treated as span_help
1 parent 90baa6a commit fcaa2c4

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
@@ -144,7 +144,9 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryWraps {
144144
(
145145
"this function's return value is unnecessary".to_string(),
146146
"remove the return type...".to_string(),
147-
snippet(cx, fn_decl.output.span(), "..").to_string(),
147+
// FIXME: we should instead get the span including the `->` and suggest an
148+
// empty string for this case.
149+
"()".to_string(),
148150
"...and then remove returned values",
149151
)
150152
} 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)