rust/tests/ui/needless_return.stderr
2024-06-25 17:50:48 +02:00

670 lines
13 KiB
Plaintext

error: unneeded `return` statement
--> tests/ui/needless_return.rs:25: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:29:5
|
LL | return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:34:5
|
LL | return true;;;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;;;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:39:5
|
LL | return true;; ; ;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;; ; ;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:44:9
|
LL | return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:46:9
|
LL | return false;
| ^^^^^^^^^^^^
|
help: remove `return`
|
LL - return false;
LL + false
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:52:17
|
LL | true => return false,
| ^^^^^^^^^^^^
|
help: remove `return`
|
LL | true => false,
| ~~~~~
error: unneeded `return` statement
--> tests/ui/needless_return.rs:54:13
|
LL | return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:61:9
|
LL | return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:63:16
|
LL | let _ = || return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL | let _ = || true;
| ~~~~
error: unneeded `return` statement
--> tests/ui/needless_return.rs:67:5
|
LL | return the_answer!();
| ^^^^^^^^^^^^^^^^^^^^
|
help: remove `return`
|
LL - return the_answer!();
LL + the_answer!()
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:70: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:75: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:77:13
|
LL | } else {
| _____________^
LL | | return;
| |______________^
|
help: remove `return`
|
LL - } else {
LL - return;
LL + } else {
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:85:14
|
LL | _ => return,
| ^^^^^^
|
help: replace `return` with a unit value
|
LL | _ => (),
| ~~
error: unneeded `return` statement
--> tests/ui/needless_return.rs:93: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:96:14
|
LL | _ => return,
| ^^^^^^
|
help: replace `return` with a unit value
|
LL | _ => (),
| ~~
error: unneeded `return` statement
--> tests/ui/needless_return.rs:109: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:111:9
|
LL | return String::new();
| ^^^^^^^^^^^^^^^^^^^^
|
help: remove `return`
|
LL - return String::new();
LL + String::new()
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:133: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:137:21
|
LL | let _ = || {
| _____________________^
LL | | return;
| |__________________^
|
help: remove `return`
|
LL - let _ = || {
LL - return;
LL + let _ = || {
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:140:20
|
LL | let _ = || return;
| ^^^^^^
|
help: replace `return` with an empty block
|
LL | let _ = || {};
| ~~
error: unneeded `return` statement
--> tests/ui/needless_return.rs:146: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:155:5
|
LL | return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:159:5
|
LL | return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:164:9
|
LL | return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:166:9
|
LL | return false;
| ^^^^^^^^^^^^
|
help: remove `return`
|
LL - return false;
LL + false
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:172:17
|
LL | true => return false,
| ^^^^^^^^^^^^
|
help: remove `return`
|
LL | true => false,
| ~~~~~
error: unneeded `return` statement
--> tests/ui/needless_return.rs:174:13
|
LL | return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:181:9
|
LL | return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL - return true;
LL + true
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:183:16
|
LL | let _ = || return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL | let _ = || true;
| ~~~~
error: unneeded `return` statement
--> tests/ui/needless_return.rs:187:5
|
LL | return the_answer!();
| ^^^^^^^^^^^^^^^^^^^^
|
help: remove `return`
|
LL - return the_answer!();
LL + the_answer!()
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:190: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:195: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:197:13
|
LL | } else {
| _____________^
LL | | return;
| |______________^
|
help: remove `return`
|
LL - } else {
LL - return;
LL + } else {
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:205:14
|
LL | _ => return,
| ^^^^^^
|
help: replace `return` with a unit value
|
LL | _ => (),
| ~~
error: unneeded `return` statement
--> tests/ui/needless_return.rs:218: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:220:9
|
LL | return String::new();
| ^^^^^^^^^^^^^^^^^^^^
|
help: remove `return`
|
LL - return String::new();
LL + String::new()
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:236: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:248:9
|
LL | return true;
| ^^^^^^^^^^^
|
help: remove `return`
|
LL ~ true
LL | } else {
LL | return false;
LL ~ }
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:250:9
|
LL | return false;
| ^^^^^^^^^^^^
|
help: remove `return`
|
LL ~ false
LL ~ }
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:257:13
|
LL | return 10;
| ^^^^^^^^^
|
help: remove `return`
|
LL ~ 10
LL | },
...
LL | },
LL ~ }
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:260:13
|
LL | return 100;
| ^^^^^^^^^^
|
help: remove `return`
|
LL ~ 100
LL | },
LL ~ }
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:268:9
|
LL | return 0;
| ^^^^^^^^
|
help: remove `return`
|
LL ~ 0
LL ~ }
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:275: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:277: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:284: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:291:20
|
LL | let _ = 42; return;
| ^^^^^^^
|
help: remove `return`
|
LL - let _ = 42; return;
LL + let _ = 42;
|
error: unneeded `return` statement
--> tests/ui/needless_return.rs:303: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:305: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:311: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:315: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:336: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