Fix clippy

This commit is contained in:
est31 2022-02-04 10:13:48 +01:00
parent dcc6153919
commit 2be8b73328
8 changed files with 45 additions and 48 deletions

View file

@ -1,5 +1,5 @@
#![feature(let_chains)] #![feature(let_chains)]
#![feature(let_else)] #![cfg_attr(bootstrap, feature(let_else))]
#![feature(once_cell)] #![feature(once_cell)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![cfg_attr(feature = "deny-warnings", deny(warnings))] #![cfg_attr(feature = "deny-warnings", deny(warnings))]

View file

@ -5,7 +5,7 @@
#![feature(drain_filter)] #![feature(drain_filter)]
#![feature(iter_intersperse)] #![feature(iter_intersperse)]
#![feature(let_chains)] #![feature(let_chains)]
#![feature(let_else)] #![cfg_attr(bootstrap, feature(let_else))]
#![feature(lint_reasons)] #![feature(lint_reasons)]
#![feature(never_type)] #![feature(never_type)]
#![feature(once_cell)] #![feature(once_cell)]

View file

@ -1,9 +1,9 @@
#![feature(array_chunks)] #![feature(array_chunks)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(control_flow_enum)] #![feature(control_flow_enum)]
#![feature(let_else)]
#![feature(let_chains)] #![feature(let_chains)]
#![feature(lint_reasons)] #![feature(lint_reasons)]
#![cfg_attr(bootstrap, feature(let_else))]
#![feature(once_cell)] #![feature(once_cell)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![recursion_limit = "512"] #![recursion_limit = "512"]

View file

@ -1,7 +1,6 @@
// run-rustfix // run-rustfix
#![feature(lint_reasons)] #![feature(lint_reasons)]
#![feature(let_else)]
#![allow(unused)] #![allow(unused)]
#![allow( #![allow(
clippy::if_same_then_else, clippy::if_same_then_else,

View file

@ -1,7 +1,6 @@
// run-rustfix // run-rustfix
#![feature(lint_reasons)] #![feature(lint_reasons)]
#![feature(let_else)]
#![allow(unused)] #![allow(unused)]
#![allow( #![allow(
clippy::if_same_then_else, clippy::if_same_then_else,

View file

@ -1,5 +1,5 @@
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:27:5 --> $DIR/needless_return.rs:26:5
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true` | ^^^^^^^^^^^^ help: remove `return`: `true`
@ -7,217 +7,217 @@ LL | return true;
= note: `-D clippy::needless-return` implied by `-D warnings` = note: `-D clippy::needless-return` implied by `-D warnings`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:31:5 --> $DIR/needless_return.rs:30:5
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true` | ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:36:9 --> $DIR/needless_return.rs:35:9
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true` | ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:38:9 --> $DIR/needless_return.rs:37:9
| |
LL | return false; LL | return false;
| ^^^^^^^^^^^^^ help: remove `return`: `false` | ^^^^^^^^^^^^^ help: remove `return`: `false`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:44:17 --> $DIR/needless_return.rs:43:17
| |
LL | true => return false, LL | true => return false,
| ^^^^^^^^^^^^ help: remove `return`: `false` | ^^^^^^^^^^^^ help: remove `return`: `false`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:46:13 --> $DIR/needless_return.rs:45:13
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true` | ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:53:9 --> $DIR/needless_return.rs:52:9
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true` | ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:55:16 --> $DIR/needless_return.rs:54:16
| |
LL | let _ = || return true; LL | let _ = || return true;
| ^^^^^^^^^^^ help: remove `return`: `true` | ^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:59:5 --> $DIR/needless_return.rs:58:5
| |
LL | return the_answer!(); LL | return the_answer!();
| ^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `the_answer!()` | ^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `the_answer!()`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:63:5 --> $DIR/needless_return.rs:62:5
| |
LL | return; LL | return;
| ^^^^^^^ help: remove `return` | ^^^^^^^ help: remove `return`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:68:9 --> $DIR/needless_return.rs:67:9
| |
LL | return; LL | return;
| ^^^^^^^ help: remove `return` | ^^^^^^^ help: remove `return`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:70:9 --> $DIR/needless_return.rs:69:9
| |
LL | return; LL | return;
| ^^^^^^^ help: remove `return` | ^^^^^^^ help: remove `return`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:77:14 --> $DIR/needless_return.rs:76:14
| |
LL | _ => return, LL | _ => return,
| ^^^^^^ help: replace `return` with a unit value: `()` | ^^^^^^ help: replace `return` with a unit value: `()`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:86:13 --> $DIR/needless_return.rs:85:13
| |
LL | return; LL | return;
| ^^^^^^^ help: remove `return` | ^^^^^^^ help: remove `return`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:88:14 --> $DIR/needless_return.rs:87:14
| |
LL | _ => return, LL | _ => return,
| ^^^^^^ help: replace `return` with a unit value: `()` | ^^^^^^ help: replace `return` with a unit value: `()`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:101:9 --> $DIR/needless_return.rs:100:9
| |
LL | return String::from("test"); LL | return String::from("test");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `String::from("test")` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `String::from("test")`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:103:9 --> $DIR/needless_return.rs:102:9
| |
LL | return String::new(); LL | return String::new();
| ^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `String::new()` | ^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `String::new()`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:125:32 --> $DIR/needless_return.rs:124:32
| |
LL | bar.unwrap_or_else(|_| return) LL | bar.unwrap_or_else(|_| return)
| ^^^^^^ help: replace `return` with an empty block: `{}` | ^^^^^^ help: replace `return` with an empty block: `{}`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:130:13 --> $DIR/needless_return.rs:129:13
| |
LL | return; LL | return;
| ^^^^^^^ help: remove `return` | ^^^^^^^ help: remove `return`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:132:20 --> $DIR/needless_return.rs:131:20
| |
LL | let _ = || return; LL | let _ = || return;
| ^^^^^^ help: replace `return` with an empty block: `{}` | ^^^^^^ help: replace `return` with an empty block: `{}`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:138:32 --> $DIR/needless_return.rs:137:32
| |
LL | res.unwrap_or_else(|_| return Foo) LL | res.unwrap_or_else(|_| return Foo)
| ^^^^^^^^^^ help: remove `return`: `Foo` | ^^^^^^^^^^ help: remove `return`: `Foo`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:147:5 --> $DIR/needless_return.rs:146:5
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true` | ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:151:5 --> $DIR/needless_return.rs:150:5
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true` | ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:156:9 --> $DIR/needless_return.rs:155:9
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true` | ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:158:9 --> $DIR/needless_return.rs:157:9
| |
LL | return false; LL | return false;
| ^^^^^^^^^^^^^ help: remove `return`: `false` | ^^^^^^^^^^^^^ help: remove `return`: `false`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:164:17 --> $DIR/needless_return.rs:163:17
| |
LL | true => return false, LL | true => return false,
| ^^^^^^^^^^^^ help: remove `return`: `false` | ^^^^^^^^^^^^ help: remove `return`: `false`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:166:13 --> $DIR/needless_return.rs:165:13
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true` | ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:173:9 --> $DIR/needless_return.rs:172:9
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true` | ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:175:16 --> $DIR/needless_return.rs:174:16
| |
LL | let _ = || return true; LL | let _ = || return true;
| ^^^^^^^^^^^ help: remove `return`: `true` | ^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:179:5 --> $DIR/needless_return.rs:178:5
| |
LL | return the_answer!(); LL | return the_answer!();
| ^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `the_answer!()` | ^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `the_answer!()`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:183:5 --> $DIR/needless_return.rs:182:5
| |
LL | return; LL | return;
| ^^^^^^^ help: remove `return` | ^^^^^^^ help: remove `return`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:188:9 --> $DIR/needless_return.rs:187:9
| |
LL | return; LL | return;
| ^^^^^^^ help: remove `return` | ^^^^^^^ help: remove `return`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:190:9 --> $DIR/needless_return.rs:189:9
| |
LL | return; LL | return;
| ^^^^^^^ help: remove `return` | ^^^^^^^ help: remove `return`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:197:14 --> $DIR/needless_return.rs:196:14
| |
LL | _ => return, LL | _ => return,
| ^^^^^^ help: replace `return` with a unit value: `()` | ^^^^^^ help: replace `return` with a unit value: `()`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:210:9 --> $DIR/needless_return.rs:209:9
| |
LL | return String::from("test"); LL | return String::from("test");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `String::from("test")` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `String::from("test")`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:212:9 --> $DIR/needless_return.rs:211:9
| |
LL | return String::new(); LL | return String::new();
| ^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `String::new()` | ^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `String::new()`
error: unneeded `return` statement error: unneeded `return` statement
--> $DIR/needless_return.rs:228:5 --> $DIR/needless_return.rs:227:5
| |
LL | return format!("Hello {}", "world!"); LL | return format!("Hello {}", "world!");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `format!("Hello {}", "world!")` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `format!("Hello {}", "world!")`

View file

@ -1,6 +1,5 @@
#![warn(clippy::semicolon_if_nothing_returned)] #![warn(clippy::semicolon_if_nothing_returned)]
#![allow(clippy::redundant_closure)] #![allow(clippy::redundant_closure)]
#![feature(let_else)]
fn get_unit() {} fn get_unit() {}

View file

@ -1,5 +1,5 @@
error: consider adding a `;` to the last statement for consistent formatting error: consider adding a `;` to the last statement for consistent formatting
--> $DIR/semicolon_if_nothing_returned.rs:9:5 --> $DIR/semicolon_if_nothing_returned.rs:8:5
| |
LL | println!("Hello") LL | println!("Hello")
| ^^^^^^^^^^^^^^^^^ help: add a `;` here: `println!("Hello");` | ^^^^^^^^^^^^^^^^^ help: add a `;` here: `println!("Hello");`
@ -7,25 +7,25 @@ LL | println!("Hello")
= note: `-D clippy::semicolon-if-nothing-returned` implied by `-D warnings` = note: `-D clippy::semicolon-if-nothing-returned` implied by `-D warnings`
error: consider adding a `;` to the last statement for consistent formatting error: consider adding a `;` to the last statement for consistent formatting
--> $DIR/semicolon_if_nothing_returned.rs:13:5 --> $DIR/semicolon_if_nothing_returned.rs:12:5
| |
LL | get_unit() LL | get_unit()
| ^^^^^^^^^^ help: add a `;` here: `get_unit();` | ^^^^^^^^^^ help: add a `;` here: `get_unit();`
error: consider adding a `;` to the last statement for consistent formatting error: consider adding a `;` to the last statement for consistent formatting
--> $DIR/semicolon_if_nothing_returned.rs:18:5 --> $DIR/semicolon_if_nothing_returned.rs:17:5
| |
LL | y = x + 1 LL | y = x + 1
| ^^^^^^^^^ help: add a `;` here: `y = x + 1;` | ^^^^^^^^^ help: add a `;` here: `y = x + 1;`
error: consider adding a `;` to the last statement for consistent formatting error: consider adding a `;` to the last statement for consistent formatting
--> $DIR/semicolon_if_nothing_returned.rs:24:9 --> $DIR/semicolon_if_nothing_returned.rs:23:9
| |
LL | hello() LL | hello()
| ^^^^^^^ help: add a `;` here: `hello();` | ^^^^^^^ help: add a `;` here: `hello();`
error: consider adding a `;` to the last statement for consistent formatting error: consider adding a `;` to the last statement for consistent formatting
--> $DIR/semicolon_if_nothing_returned.rs:35:9 --> $DIR/semicolon_if_nothing_returned.rs:34:9
| |
LL | ptr::drop_in_place(s.as_mut_ptr()) LL | ptr::drop_in_place(s.as_mut_ptr())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `ptr::drop_in_place(s.as_mut_ptr());` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `ptr::drop_in_place(s.as_mut_ptr());`