Improve lint message

This commit is contained in:
Hirochika Matsumoto 2020-10-12 19:27:47 +09:00
parent eec7f5c111
commit 1bdac87128
2 changed files with 5 additions and 5 deletions

View file

@ -100,7 +100,7 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryWrap {
cx,
UNNECESSARY_WRAP,
span,
format!("this function's return value is unnecessarily wrapped by `{}`, return_type)",
format!("this function's return value is unnecessarily wrapped by `{}`", return_type).as_str(),
|diag| {
let inner_ty = return_ty(cx, hir_id)
.walk()

View file

@ -1,4 +1,4 @@
error: this function returns unnecessarily wrapping data
error: this function's return value is unnecessarily wrapped by `Option`
--> $DIR/unnecessary_wrap.rs:8:1
|
LL | / fn func1(a: bool, b: bool) -> Option<i32> {
@ -25,7 +25,7 @@ LL | 2
LL | } else {
...
error: this function returns unnecessarily wrapping data
error: this function's return value is unnecessarily wrapped by `Option`
--> $DIR/unnecessary_wrap.rs:21:1
|
LL | / fn func2(a: bool, b: bool) -> Option<i32> {
@ -51,7 +51,7 @@ LL | } else {
LL | 30
|
error: this function returns unnecessarily wrapping data
error: this function's return value is unnecessarily wrapped by `Option`
--> $DIR/unnecessary_wrap.rs:51:1
|
LL | / fn func5() -> Option<i32> {
@ -68,7 +68,7 @@ help: ...and change the returning expressions
LL | 1
|
error: this function returns unnecessarily wrapping data
error: this function's return value is unnecessarily wrapped by `Result`
--> $DIR/unnecessary_wrap.rs:61:1
|
LL | / fn func7() -> Result<i32, ()> {