rust/tests/ui/needless_return.stderr

670 lines
13 KiB
Plaintext

error: unneeded `return` statement
--> tests/ui/needless_return.rs:26:5
|
LL | return true;
| ^^^^^^^^^^^
|
= note: `-D clippy::needless-return` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::needless_return)]`
help: remove `return`
|
LL - return true;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:30:5
|
LL | return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:35:5
|
LL | return true;;;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;;;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:40:5
|
LL | return true;; ; ;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;; ; ;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:45:9
|
LL | return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:47:9
|
LL | return false;
| ^^^^^^^^^^^^
|
help: remove `return`
|
LL - return false;
LL + false
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:53:17
|
LL | true => return false,
| ^^^^^^^^^^^^
|
help: remove `return`
|
LL | true => false,
| ~~~~~
error: unneeded `return` statement
--> tests/ui/needless_return.rs:55:13
|
LL | return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:62:9
|
LL | return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:64:16
|
LL | let _ = || return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL | let _ = || true;
| ~~~~
error: unneeded `return` statement
--> tests/ui/needless_return.rs:68:5
|
LL | return the_answer!();
| ^^^^^^^^^^^^^^^^^^^^
|
help: remove `return`
|
LL - return the_answer!();
LL + the_answer!()
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:71:21
|
LL | fn test_void_fun() {
| _____________________^
LL | | return;
| |__________^
|
help: remove `return`
|
LL - fn test_void_fun() {
LL - return;
LL + fn test_void_fun() {
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:76:11
|
LL | if b {
| ___________^
LL | | return;
| |______________^
|
help: remove `return`
|
LL - if b {
LL - return;
LL + if b {
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:78:13
|
LL | } else {
| _____________^
LL | | return;
| |______________^
|
help: remove `return`
|
LL - } else {
LL - return;
LL + } else {
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:86:14
|
LL | _ => return,
| ^^^^^^
|
help: replace `return` with a unit value
|
LL | _ => (),
| ~~
error: unneeded `return` statement
--> tests/ui/needless_return.rs:94:24
|
LL | let _ = 42;
| ________________________^
LL | | return;
| |__________________^
|
help: remove `return`
|
LL - let _ = 42;
LL - return;
LL + let _ = 42;
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:97:14
|
LL | _ => return,
| ^^^^^^
|
help: replace `return` with a unit value
|
LL | _ => (),
| ~~
error: unneeded `return` statement
--> tests/ui/needless_return.rs:110:9
|
LL | return String::from("test");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove `return`
|
LL - return String::from("test");
LL + String::from("test")
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:112:9
|
LL | return String::new();
| ^^^^^^^^^^^^^^^^^^^^
|
help: remove `return`
|
LL - return String::new();
LL + String::new()
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:134:32
|
LL | bar.unwrap_or_else(|_| return)
| ^^^^^^
|
help: replace `return` with an empty block
|
LL | bar.unwrap_or_else(|_| {})
| ~~
error: unneeded `return` statement
--> tests/ui/needless_return.rs:138:21
|
LL | let _ = || {
| _____________________^
LL | | return;
| |__________________^
|
help: remove `return`
|
LL - let _ = || {
LL - return;
LL + let _ = || {
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:141:20
|
LL | let _ = || return;
| ^^^^^^
|
help: replace `return` with an empty block
|
LL | let _ = || {};
| ~~
error: unneeded `return` statement
--> tests/ui/needless_return.rs:147:32
|
LL | res.unwrap_or_else(|_| return Foo)
| ^^^^^^^^^^
|
help: remove `return`
|
LL | res.unwrap_or_else(|_| Foo)
| ~~~
error: unneeded `return` statement
--> tests/ui/needless_return.rs:156:5
|
LL | return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:160:5
|
LL | return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:165:9
|
LL | return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:167:9
|
LL | return false;
| ^^^^^^^^^^^^
|
help: remove `return`
|
LL - return false;
LL + false
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:173:17
|
LL | true => return false,
| ^^^^^^^^^^^^
|
help: remove `return`
|
LL | true => false,
| ~~~~~
error: unneeded `return` statement
--> tests/ui/needless_return.rs:175:13
|
LL | return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:182:9
|
LL | return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:184:16
|
LL | let _ = || return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL | let _ = || true;
| ~~~~
error: unneeded `return` statement
--> tests/ui/needless_return.rs:188:5
|
LL | return the_answer!();
| ^^^^^^^^^^^^^^^^^^^^
|
help: remove `return`
|
LL - return the_answer!();
LL + the_answer!()
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:191:33
|
LL | async fn async_test_void_fun() {
| _________________________________^
LL | | return;
| |__________^
|
help: remove `return`
|
LL - async fn async_test_void_fun() {
LL - return;
LL + async fn async_test_void_fun() {
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:196:11
|
LL | if b {
| ___________^
LL | | return;
| |______________^
|
help: remove `return`
|
LL - if b {
LL - return;
LL + if b {
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:198:13
|
LL | } else {
| _____________^
LL | | return;
| |______________^
|
help: remove `return`
|
LL - } else {
LL - return;
LL + } else {
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:206:14
|
LL | _ => return,
| ^^^^^^
|
help: replace `return` with a unit value
|
LL | _ => (),
| ~~
error: unneeded `return` statement
--> tests/ui/needless_return.rs:219:9
|
LL | return String::from("test");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove `return`
|
LL - return String::from("test");
LL + String::from("test")
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:221:9
|
LL | return String::new();
| ^^^^^^^^^^^^^^^^^^^^
|
help: remove `return`
|
LL - return String::new();
LL + String::new()
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:237:5
|
LL | return format!("Hello {}", "world!");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove `return`
|
LL - return format!("Hello {}", "world!");
LL + format!("Hello {}", "world!")
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:249:9
|
LL | return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL ~ true
LL | } else {
LL | return false;
LL ~ }
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:251:9
|
LL | return false;
| ^^^^^^^^^^^^
|
help: remove `return`
|
LL ~ false
LL ~ }
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:258:13
|
LL | return 10;
| ^^^^^^^^^
|
help: remove `return`
|
LL ~ 10
LL | },
...
LL | },
LL ~ }
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:261:13
|
LL | return 100;
| ^^^^^^^^^^
|
help: remove `return`
|
LL ~ 100
LL | },
LL ~ }
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:269:9
|
LL | return 0;
| ^^^^^^^^
|
help: remove `return`
|
LL ~ 0
LL ~ }
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:276:13
|
LL | return *(x as *const isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove `return`
|
LL ~ *(x as *const isize)
LL | } else {
LL | return !*(x as *const isize);
LL ~ }
LL ~ }
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:278:13
|
LL | return !*(x as *const isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove `return`
|
LL ~ !*(x as *const isize)
LL ~ }
LL ~ }
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:285:20
|
LL | let _ = 42;
| ____________________^
LL | |
LL | | return;
| |______________^
|
help: remove `return`
|
LL - let _ = 42;
LL -
LL - return;
LL + let _ = 42;
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:292:20
|
LL | let _ = 42; return;
| ^^^^^^^
|
help: remove `return`
|
LL - let _ = 42; return;
LL + let _ = 42;
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:304:9
|
LL | return Ok(format!("ok!"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove `return`
|
LL - return Ok(format!("ok!"));
LL + Ok(format!("ok!"))
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:306:9
|
LL | return Err(format!("err!"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove `return`
|
LL - return Err(format!("err!"));
LL + Err(format!("err!"))
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:312:9
|
LL | return if true { 1 } else { 2 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove `return`
|
LL - return if true { 1 } else { 2 };
LL + if true { 1 } else { 2 }
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:316:9
|
LL | return if b1 { 0 } else { 1 } | if b2 { 2 } else { 3 } | if b3 { 4 } else { 5 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove `return` and wrap the sequence with parentheses
|
LL - return if b1 { 0 } else { 1 } | if b2 { 2 } else { 3 } | if b3 { 4 } else { 5 };
LL + (if b1 { 0 } else { 1 } | if b2 { 2 } else { 3 } | if b3 { 4 } else { 5 })
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:337:5
|
LL | return { "a".to_string() } + "b" + { "c" };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove `return` and wrap the sequence with parentheses
|
LL - return { "a".to_string() } + "b" + { "c" };
LL + ({ "a".to_string() } + "b" + { "c" })
|
error: aborting due to 53 previous errors