2020-01-06 00:36:33 -06:00
|
|
|
error: unneeded `return` statement
|
2024-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:25: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-02-10 16:31:36 -06: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
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:34: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:39: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:44: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:46: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:52: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:54: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:61: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:63: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:67: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:70: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:75: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:77: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:85: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:93: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:96: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:109: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:111: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:133: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:137: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:140: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:146: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:155: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-02-10 16:31:36 -06: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:164: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:166: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:172: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:174: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:181: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:183: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:187: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:190: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:195: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:197: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:205: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:218: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:220: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-02-10 16:31:36 -06:00
|
|
|
--> tests/ui/needless_return.rs:236: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-07-01 06:49:16 -05:00
|
|
|
--> tests/ui/needless_return.rs:277: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-07-01 06:49:16 -05:00
|
|
|
--> tests/ui/needless_return.rs:279: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-07-01 06:49:16 -05:00
|
|
|
--> tests/ui/needless_return.rs:286: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-07-01 06:49:16 -05:00
|
|
|
--> tests/ui/needless_return.rs:289: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-07-01 06:49:16 -05:00
|
|
|
--> tests/ui/needless_return.rs:297: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-07-01 06:49:16 -05:00
|
|
|
--> tests/ui/needless_return.rs:304: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-07-01 06:49:16 -05:00
|
|
|
--> tests/ui/needless_return.rs:306: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-07-01 06:49:16 -05:00
|
|
|
--> tests/ui/needless_return.rs:313: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-07-01 06:49:16 -05:00
|
|
|
--> tests/ui/needless_return.rs:320: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-07-01 06:49:16 -05:00
|
|
|
--> tests/ui/needless_return.rs:332: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-07-01 06:49:16 -05:00
|
|
|
--> tests/ui/needless_return.rs:334: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-07-01 06:49:16 -05:00
|
|
|
--> tests/ui/needless_return.rs:340: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-07-01 06:49:16 -05:00
|
|
|
--> tests/ui/needless_return.rs:344: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-07-01 06:49:16 -05:00
|
|
|
--> tests/ui/needless_return.rs:365: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" })
|
|
|
|
|
|
|
|
|
|
|
|
|
error: aborting due to 53 previous errors
|
2018-01-16 10:06:27 -06:00
|
|
|
|