2020-01-06 00:36:33 -06:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:29:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | return true;
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-08-01 09:30:44 -05:00
|
|
|
= note: `-D clippy::needless-return` implied by `-D warnings`
|
2023-08-01 07:02:21 -05:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::needless_return)]`
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return true;
|
|
|
|
LL + true
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2020-01-06 00:36:33 -06:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:33:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | return true;
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return true;
|
|
|
|
LL + true
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2020-01-06 00:36:33 -06:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:38:5
|
2023-01-27 14:09:08 -06:00
|
|
|
|
|
|
|
|
LL | return true;;;
|
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return true;;;
|
|
|
|
LL + true
|
|
|
|
|
|
2023-01-27 14:09:08 -06:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:43:5
|
2023-01-27 14:09:08 -06:00
|
|
|
|
|
|
|
|
LL | return true;; ; ;
|
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return true;; ; ;
|
|
|
|
LL + true
|
|
|
|
|
|
2023-01-27 14:09:08 -06:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:48:9
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | return true;
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return true;
|
|
|
|
LL + true
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2020-01-06 00:36:33 -06:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:50:9
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | return false;
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return false;
|
|
|
|
LL + false
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2020-01-06 00:36:33 -06:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:56:17
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | true => return false,
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL | true => false,
|
|
|
|
| ~~~~~
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2020-01-06 00:36:33 -06:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:58:13
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | return true;
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return true;
|
|
|
|
LL + true
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2020-01-06 00:36:33 -06:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:65:9
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | return true;
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return true;
|
|
|
|
LL + true
|
|
|
|
|
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2020-01-06 00:36:33 -06:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:67:16
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | let _ = || return true;
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL | let _ = || true;
|
|
|
|
| ~~~~
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2022-06-04 06:34:07 -05:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:71:5
|
2022-06-04 06:34:07 -05:00
|
|
|
|
|
|
|
|
LL | return the_answer!();
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return the_answer!();
|
|
|
|
LL + the_answer!()
|
|
|
|
|
|
2022-06-04 06:34:07 -05:00
|
|
|
|
2020-01-06 00:36:33 -06:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:74:21
|
2019-06-19 07:56:02 -05:00
|
|
|
|
|
2022-12-01 11:29:38 -06:00
|
|
|
LL | fn test_void_fun() {
|
|
|
|
| _____________________^
|
|
|
|
LL | | return;
|
|
|
|
| |__________^
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - fn test_void_fun() {
|
|
|
|
LL - return;
|
|
|
|
LL + fn test_void_fun() {
|
|
|
|
|
|
2019-06-19 07:56:02 -05:00
|
|
|
|
2020-01-06 00:36:33 -06:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:79:11
|
2019-06-19 07:56:02 -05:00
|
|
|
|
|
2022-12-01 11:29:38 -06:00
|
|
|
LL | if b {
|
|
|
|
| ___________^
|
|
|
|
LL | | return;
|
|
|
|
| |______________^
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - if b {
|
|
|
|
LL - return;
|
|
|
|
LL + if b {
|
|
|
|
|
|
2019-06-19 07:56:02 -05:00
|
|
|
|
2020-01-06 00:36:33 -06:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:81:13
|
2019-06-19 07:56:02 -05:00
|
|
|
|
|
2022-12-01 11:29:38 -06:00
|
|
|
LL | } else {
|
|
|
|
| _____________^
|
|
|
|
LL | | return;
|
|
|
|
| |______________^
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - } else {
|
|
|
|
LL - return;
|
|
|
|
LL + } else {
|
|
|
|
|
|
2019-06-19 07:56:02 -05:00
|
|
|
|
2020-01-06 00:36:33 -06:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:89:14
|
2019-06-20 06:44:00 -05:00
|
|
|
|
|
|
|
|
LL | _ => return,
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: replace `return` with a unit value
|
|
|
|
|
|
|
|
|
LL | _ => (),
|
|
|
|
| ~~
|
2019-06-20 06:44:00 -05:00
|
|
|
|
2020-08-28 09:10:16 -05:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:97:24
|
2021-12-30 08:10:43 -06:00
|
|
|
|
|
2022-12-01 11:29:38 -06:00
|
|
|
LL | let _ = 42;
|
|
|
|
| ________________________^
|
|
|
|
LL | | return;
|
|
|
|
| |__________________^
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - let _ = 42;
|
|
|
|
LL - return;
|
|
|
|
LL + let _ = 42;
|
|
|
|
|
|
2021-12-30 08:10:43 -06:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:100:14
|
2021-12-30 08:10:43 -06:00
|
|
|
|
|
|
|
|
LL | _ => return,
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: replace `return` with a unit value
|
|
|
|
|
|
|
|
|
LL | _ => (),
|
|
|
|
| ~~
|
2021-12-30 08:10:43 -06:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:113:9
|
2020-08-28 09:10:16 -05:00
|
|
|
|
|
|
|
|
LL | return String::from("test");
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return String::from("test");
|
|
|
|
LL + String::from("test")
|
|
|
|
|
|
2020-08-28 09:10:16 -05:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:115:9
|
2020-08-28 09:10:16 -05:00
|
|
|
|
|
|
|
|
LL | return String::new();
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return String::new();
|
|
|
|
LL + String::new()
|
|
|
|
|
|
2020-08-28 09:10:16 -05:00
|
|
|
|
2021-01-30 11:06:34 -06:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:137:32
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
|
|
|
LL | bar.unwrap_or_else(|_| return)
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: replace `return` with an empty block
|
|
|
|
|
|
|
|
|
LL | bar.unwrap_or_else(|_| {})
|
|
|
|
| ~~
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:141:21
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
2022-12-01 11:29:38 -06:00
|
|
|
LL | let _ = || {
|
|
|
|
| _____________________^
|
|
|
|
LL | | return;
|
|
|
|
| |__________________^
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - let _ = || {
|
|
|
|
LL - return;
|
|
|
|
LL + let _ = || {
|
|
|
|
|
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:144:20
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
|
|
|
LL | let _ = || return;
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: replace `return` with an empty block
|
|
|
|
|
|
|
|
|
LL | let _ = || {};
|
|
|
|
| ~~
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:150:32
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
|
|
|
LL | res.unwrap_or_else(|_| return Foo)
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL | res.unwrap_or_else(|_| Foo)
|
|
|
|
| ~~~
|
2021-01-30 11:06:34 -06:00
|
|
|
|
2021-04-22 04:31:13 -05:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:159:5
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
|
LL | return true;
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return true;
|
|
|
|
LL + true
|
|
|
|
|
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:163:5
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
|
LL | return true;
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return true;
|
|
|
|
LL + true
|
|
|
|
|
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:168:9
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
|
LL | return true;
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return true;
|
|
|
|
LL + true
|
|
|
|
|
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:170:9
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
|
LL | return false;
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return false;
|
|
|
|
LL + false
|
|
|
|
|
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:176:17
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
|
LL | true => return false,
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL | true => false,
|
|
|
|
| ~~~~~
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:178:13
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
|
LL | return true;
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return true;
|
|
|
|
LL + true
|
|
|
|
|
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:185:9
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
|
LL | return true;
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return true;
|
|
|
|
LL + true
|
|
|
|
|
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:187:16
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
|
LL | let _ = || return true;
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL | let _ = || true;
|
|
|
|
| ~~~~
|
2021-04-22 04:31:13 -05:00
|
|
|
|
2022-06-04 06:34:07 -05:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:191:5
|
2022-06-04 06:34:07 -05:00
|
|
|
|
|
|
|
|
LL | return the_answer!();
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return the_answer!();
|
|
|
|
LL + the_answer!()
|
|
|
|
|
|
2022-06-04 06:34:07 -05:00
|
|
|
|
2021-04-22 04:31:13 -05:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:194:33
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
2022-12-01 11:29:38 -06:00
|
|
|
LL | async fn async_test_void_fun() {
|
|
|
|
| _________________________________^
|
|
|
|
LL | | return;
|
|
|
|
| |__________^
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - async fn async_test_void_fun() {
|
|
|
|
LL - return;
|
|
|
|
LL + async fn async_test_void_fun() {
|
|
|
|
|
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:199:11
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
2022-12-01 11:29:38 -06:00
|
|
|
LL | if b {
|
|
|
|
| ___________^
|
|
|
|
LL | | return;
|
|
|
|
| |______________^
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - if b {
|
|
|
|
LL - return;
|
|
|
|
LL + if b {
|
|
|
|
|
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:201:13
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
2022-12-01 11:29:38 -06:00
|
|
|
LL | } else {
|
|
|
|
| _____________^
|
|
|
|
LL | | return;
|
|
|
|
| |______________^
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - } else {
|
|
|
|
LL - return;
|
|
|
|
LL + } else {
|
|
|
|
|
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:209:14
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
|
LL | _ => return,
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: replace `return` with a unit value
|
|
|
|
|
|
|
|
|
LL | _ => (),
|
|
|
|
| ~~
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:222:9
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
|
LL | return String::from("test");
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return String::from("test");
|
|
|
|
LL + String::from("test")
|
|
|
|
|
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:224:9
|
2021-04-22 04:31:13 -05:00
|
|
|
|
|
|
|
|
LL | return String::new();
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return String::new();
|
|
|
|
LL + String::new()
|
|
|
|
|
|
2021-04-22 04:31:13 -05:00
|
|
|
|
2022-06-04 06:34:07 -05:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:240:5
|
2022-06-04 06:34:07 -05:00
|
|
|
|
|
|
|
|
LL | return format!("Hello {}", "world!");
|
2022-10-06 02:44:38 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return format!("Hello {}", "world!");
|
|
|
|
LL + format!("Hello {}", "world!")
|
|
|
|
|
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:281:9
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
|
|
|
LL | return true;
|
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL ~ true
|
|
|
|
LL | } else {
|
|
|
|
LL | return false;
|
|
|
|
LL ~ }
|
|
|
|
|
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:283:9
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
|
|
|
LL | return false;
|
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL ~ false
|
|
|
|
LL ~ }
|
|
|
|
|
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:290:13
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
|
|
|
LL | return 10;
|
|
|
|
| ^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL ~ 10
|
|
|
|
LL | },
|
2024-06-19 23:25:17 -05:00
|
|
|
...
|
2023-06-02 04:41:57 -05:00
|
|
|
LL | },
|
|
|
|
LL ~ }
|
|
|
|
|
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:293:13
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
|
|
|
LL | return 100;
|
|
|
|
| ^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL ~ 100
|
|
|
|
LL | },
|
|
|
|
LL ~ }
|
|
|
|
|
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:301:9
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
|
|
|
LL | return 0;
|
|
|
|
| ^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL ~ 0
|
|
|
|
LL ~ }
|
|
|
|
|
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:308:13
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
|
|
|
LL | return *(x as *const isize);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL ~ *(x as *const isize)
|
|
|
|
LL | } else {
|
|
|
|
LL | return !*(x as *const isize);
|
|
|
|
LL ~ }
|
|
|
|
LL ~ }
|
|
|
|
|
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:310:13
|
2022-10-06 02:44:38 -05:00
|
|
|
|
|
|
|
|
LL | return !*(x as *const isize);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL ~ !*(x as *const isize)
|
|
|
|
LL ~ }
|
|
|
|
LL ~ }
|
|
|
|
|
|
2022-06-04 06:34:07 -05:00
|
|
|
|
2022-12-01 11:29:38 -06:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:317:20
|
2022-12-01 11:29:38 -06:00
|
|
|
|
|
|
|
|
LL | let _ = 42;
|
|
|
|
| ____________________^
|
|
|
|
LL | |
|
|
|
|
LL | | return;
|
|
|
|
| |______________^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - let _ = 42;
|
|
|
|
LL -
|
|
|
|
LL - return;
|
|
|
|
LL + let _ = 42;
|
|
|
|
|
|
2022-12-01 11:29:38 -06:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:324:20
|
2022-12-01 11:29:38 -06:00
|
|
|
|
|
|
|
|
LL | let _ = 42; return;
|
|
|
|
| ^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - let _ = 42; return;
|
|
|
|
LL + let _ = 42;
|
|
|
|
|
|
2022-12-01 11:29:38 -06:00
|
|
|
|
2023-01-12 12:48:13 -06:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:336:9
|
2023-01-12 12:48:13 -06:00
|
|
|
|
|
|
|
|
LL | return Ok(format!("ok!"));
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return Ok(format!("ok!"));
|
|
|
|
LL + Ok(format!("ok!"))
|
|
|
|
|
|
2023-01-12 12:48:13 -06:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:338:9
|
2023-01-12 12:48:13 -06:00
|
|
|
|
|
|
|
|
LL | return Err(format!("err!"));
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return Err(format!("err!"));
|
|
|
|
LL + Err(format!("err!"))
|
|
|
|
|
|
2023-01-12 12:48:13 -06:00
|
|
|
|
2023-02-25 18:08:29 -06:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:344:9
|
2023-02-25 18:08:29 -06:00
|
|
|
|
|
|
|
|
LL | return if true { 1 } else { 2 };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return if true { 1 } else { 2 };
|
|
|
|
LL + if true { 1 } else { 2 }
|
|
|
|
|
|
2023-02-25 18:08:29 -06:00
|
|
|
|
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:348:9
|
2023-02-25 18:08:29 -06:00
|
|
|
|
|
|
|
|
LL | return if b1 { 0 } else { 1 } | if b2 { 2 } else { 3 } | if b3 { 4 } else { 5 };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
2023-06-02 04:41:57 -05:00
|
|
|
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 })
|
|
|
|
|
|
2023-02-25 18:08:29 -06:00
|
|
|
|
2024-05-30 03:49:05 -05:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:369:5
|
2024-05-30 03:49:05 -05:00
|
|
|
|
|
|
|
|
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" })
|
|
|
|
|
|
|
|
|
|
2024-08-03 19:24:51 -05:00
|
|
|
error: unneeded `return` statement
|
2024-09-26 10:44:59 -05:00
|
|
|
--> tests/ui/needless_return.rs:373:5
|
2024-08-03 19:24:51 -05:00
|
|
|
|
|
|
|
|
LL | return "".split("").next().unwrap().to_string();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: remove `return`
|
|
|
|
|
|
|
|
|
LL - return "".split("").next().unwrap().to_string();
|
|
|
|
LL + "".split("").next().unwrap().to_string()
|
|
|
|
|
|
|
|
|
|
|
|
|
error: aborting due to 54 previous errors
|
2018-01-16 10:06:27 -06:00
|
|
|
|