Skip to content

Commit bc705c3

Browse files
committed
Improve lint message
1 parent 75e9227 commit bc705c3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

clippy_lints/src/unnecessary_wrap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryWrap {
100100
cx,
101101
UNNECESSARY_WRAP,
102102
span,
103-
format!("this function's return value is unnecessarily wrapped by `{}`, return_type)",
103+
format!("this function's return value is unnecessarily wrapped by `{}`", return_type).as_str(),
104104
|diag| {
105105
let inner_ty = return_ty(cx, hir_id)
106106
.walk()

tests/ui/unnecessary_wrap.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: this function returns unnecessarily wrapping data
1+
error: this function's return value is unnecessarily wrapped by `Option`
22
--> $DIR/unnecessary_wrap.rs:8:1
33
|
44
LL | / fn func1(a: bool, b: bool) -> Option<i32> {
@@ -25,7 +25,7 @@ LL | 2
2525
LL | } else {
2626
...
2727

28-
error: this function returns unnecessarily wrapping data
28+
error: this function's return value is unnecessarily wrapped by `Option`
2929
--> $DIR/unnecessary_wrap.rs:21:1
3030
|
3131
LL | / fn func2(a: bool, b: bool) -> Option<i32> {
@@ -51,7 +51,7 @@ LL | } else {
5151
LL | 30
5252
|
5353

54-
error: this function returns unnecessarily wrapping data
54+
error: this function's return value is unnecessarily wrapped by `Option`
5555
--> $DIR/unnecessary_wrap.rs:51:1
5656
|
5757
LL | / fn func5() -> Option<i32> {
@@ -68,7 +68,7 @@ help: ...and change the returning expressions
6868
LL | 1
6969
|
7070

71-
error: this function returns unnecessarily wrapping data
71+
error: this function's return value is unnecessarily wrapped by `Result`
7272
--> $DIR/unnecessary_wrap.rs:61:1
7373
|
7474
LL | / fn func7() -> Result<i32, ()> {

0 commit comments

Comments
 (0)