make tests consistent

This commit is contained in:
Yuri Astrakhan 2025-02-15 19:54:54 -05:00
parent d063e09d10
commit 8e50cfacdf
21 changed files with 139 additions and 111 deletions

View file

@ -1,5 +1,6 @@
#![deny(clippy::index_refutable_slice)]
#![allow(clippy::uninlined_format_args)]
#![deny(clippy::index_refutable_slice)]
fn below_limit() {
let slice: Option<&[u32]> = Some(&[1, 2, 3]);
if let Some([_, _, _, _, _, _, _, slice_7, ..]) = slice {

View file

@ -1,5 +1,6 @@
#![deny(clippy::index_refutable_slice)]
#![allow(clippy::uninlined_format_args)]
#![deny(clippy::index_refutable_slice)]
fn below_limit() {
let slice: Option<&[u32]> = Some(&[1, 2, 3]);
if let Some(slice) = slice {

View file

@ -1,11 +1,11 @@
error: this binding can be a slice pattern to avoid indexing
--> tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.rs:5:17
--> tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.rs:6:17
|
LL | if let Some(slice) = slice {
| ^^^^^
|
note: the lint level is defined here
--> tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.rs:1:9
--> tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.rs:2:9
|
LL | #![deny(clippy::index_refutable_slice)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,4 +1,5 @@
//@ check-pass
#![allow(clippy::uninlined_format_args)]
fn main() {

View file

@ -1,6 +1,11 @@
#![allow(
clippy::no_effect,
clippy::uninlined_format_args,
clippy::unit_arg,
clippy::unnecessary_operation
)]
#![warn(clippy::dbg_macro)]
#![allow(clippy::unnecessary_operation, clippy::no_effect, clippy::unit_arg)]
#![allow(clippy::uninlined_format_args)]
fn foo(n: u32) -> u32 {
if let Some(n) = n.checked_sub(4) { n } else { n }
//~^ dbg_macro

View file

@ -1,6 +1,11 @@
#![allow(
clippy::no_effect,
clippy::uninlined_format_args,
clippy::unit_arg,
clippy::unnecessary_operation
)]
#![warn(clippy::dbg_macro)]
#![allow(clippy::unnecessary_operation, clippy::no_effect, clippy::unit_arg)]
#![allow(clippy::uninlined_format_args)]
fn foo(n: u32) -> u32 {
if let Some(n) = dbg!(n.checked_sub(4)) { n } else { n }
//~^ dbg_macro

View file

@ -1,5 +1,5 @@
error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:5:22
--> tests/ui/dbg_macro/dbg_macro.rs:10:22
|
LL | if let Some(n) = dbg!(n.checked_sub(4)) { n } else { n }
| ^^^^^^^^^^^^^^^^^^^^^^
@ -13,7 +13,7 @@ LL + if let Some(n) = n.checked_sub(4) { n } else { n }
|
error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:11:8
--> tests/ui/dbg_macro/dbg_macro.rs:16:8
|
LL | if dbg!(n <= 1) {
| ^^^^^^^^^^^^
@ -25,7 +25,7 @@ LL + if n <= 1 {
|
error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:14:9
--> tests/ui/dbg_macro/dbg_macro.rs:19:9
|
LL | dbg!(1)
| ^^^^^^^
@ -37,7 +37,7 @@ LL + 1
|
error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:17:9
--> tests/ui/dbg_macro/dbg_macro.rs:22:9
|
LL | dbg!(n * factorial(n - 1))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -49,7 +49,7 @@ LL + n * factorial(n - 1)
|
error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:23:5
--> tests/ui/dbg_macro/dbg_macro.rs:28:5
|
LL | dbg!(42);
| ^^^^^^^^
@ -61,7 +61,7 @@ LL + 42;
|
error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:26:14
--> tests/ui/dbg_macro/dbg_macro.rs:31:14
|
LL | foo(3) + dbg!(factorial(4));
| ^^^^^^^^^^^^^^^^^^
@ -73,7 +73,7 @@ LL + foo(3) + factorial(4);
|
error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:29:5
--> tests/ui/dbg_macro/dbg_macro.rs:34:5
|
LL | dbg!(1, 2, 3, 4, 5);
| ^^^^^^^^^^^^^^^^^^^
@ -85,7 +85,7 @@ LL + (1, 2, 3, 4, 5);
|
error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:51:5
--> tests/ui/dbg_macro/dbg_macro.rs:56:5
|
LL | dbg!();
| ^^^^^^
@ -96,7 +96,7 @@ LL - dbg!();
|
error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:55:13
--> tests/ui/dbg_macro/dbg_macro.rs:60:13
|
LL | let _ = dbg!();
| ^^^^^^
@ -108,7 +108,7 @@ LL + let _ = ();
|
error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:58:9
--> tests/ui/dbg_macro/dbg_macro.rs:63:9
|
LL | bar(dbg!());
| ^^^^^^
@ -120,7 +120,7 @@ LL + bar(());
|
error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:61:10
--> tests/ui/dbg_macro/dbg_macro.rs:66:10
|
LL | foo!(dbg!());
| ^^^^^^
@ -132,7 +132,7 @@ LL + foo!(());
|
error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:64:16
--> tests/ui/dbg_macro/dbg_macro.rs:69:16
|
LL | foo2!(foo!(dbg!()));
| ^^^^^^
@ -144,7 +144,7 @@ LL + foo2!(foo!(()));
|
error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:46:13
--> tests/ui/dbg_macro/dbg_macro.rs:51:13
|
LL | dbg!();
| ^^^^^^
@ -159,7 +159,7 @@ LL - dbg!();
|
error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:87:9
--> tests/ui/dbg_macro/dbg_macro.rs:92:9
|
LL | dbg!(2);
| ^^^^^^^
@ -171,7 +171,7 @@ LL + 2;
|
error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:94:5
--> tests/ui/dbg_macro/dbg_macro.rs:99:5
|
LL | dbg!(1);
| ^^^^^^^
@ -183,7 +183,7 @@ LL + 1;
|
error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:100:5
--> tests/ui/dbg_macro/dbg_macro.rs:105:5
|
LL | dbg!(1);
| ^^^^^^^
@ -195,7 +195,7 @@ LL + 1;
|
error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:107:9
--> tests/ui/dbg_macro/dbg_macro.rs:112:9
|
LL | dbg!(1);
| ^^^^^^^
@ -207,7 +207,7 @@ LL + 1;
|
error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:114:31
--> tests/ui/dbg_macro/dbg_macro.rs:119:31
|
LL | println!("dbg: {:?}", dbg!(s));
| ^^^^^^^
@ -219,7 +219,7 @@ LL + println!("dbg: {:?}", s);
|
error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:117:22
--> tests/ui/dbg_macro/dbg_macro.rs:122:22
|
LL | print!("{}", dbg!(s));
| ^^^^^^^

View file

@ -1,7 +1,10 @@
#![allow(
clippy::future_not_send,
clippy::manual_async_fn,
clippy::never_loop,
clippy::uninlined_format_args
)]
#![warn(clippy::large_futures)]
#![allow(clippy::never_loop)]
#![allow(clippy::future_not_send)]
#![allow(clippy::manual_async_fn, clippy::uninlined_format_args)]
async fn big_fut(_arg: [u8; 1024 * 16]) {}

View file

@ -1,7 +1,10 @@
#![allow(
clippy::future_not_send,
clippy::manual_async_fn,
clippy::never_loop,
clippy::uninlined_format_args
)]
#![warn(clippy::large_futures)]
#![allow(clippy::never_loop)]
#![allow(clippy::future_not_send)]
#![allow(clippy::manual_async_fn, clippy::uninlined_format_args)]
async fn big_fut(_arg: [u8; 1024 * 16]) {}

View file

@ -1,5 +1,5 @@
error: large future with a size of 16385 bytes
--> tests/ui/large_futures.rs:10:9
--> tests/ui/large_futures.rs:13:9
|
LL | big_fut([0u8; 1024 * 16]).await;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Box::pin` on it: `Box::pin(big_fut([0u8; 1024 * 16]))`
@ -8,37 +8,37 @@ LL | big_fut([0u8; 1024 * 16]).await;
= help: to override `-D warnings` add `#[allow(clippy::large_futures)]`
error: large future with a size of 16386 bytes
--> tests/ui/large_futures.rs:13:5
--> tests/ui/large_futures.rs:16:5
|
LL | f.await
| ^ help: consider `Box::pin` on it: `Box::pin(f)`
error: large future with a size of 16387 bytes
--> tests/ui/large_futures.rs:18:9
--> tests/ui/large_futures.rs:21:9
|
LL | wait().await;
| ^^^^^^ help: consider `Box::pin` on it: `Box::pin(wait())`
error: large future with a size of 16387 bytes
--> tests/ui/large_futures.rs:24:13
--> tests/ui/large_futures.rs:27:13
|
LL | wait().await;
| ^^^^^^ help: consider `Box::pin` on it: `Box::pin(wait())`
error: large future with a size of 65540 bytes
--> tests/ui/large_futures.rs:32:5
--> tests/ui/large_futures.rs:35:5
|
LL | foo().await;
| ^^^^^ help: consider `Box::pin` on it: `Box::pin(foo())`
error: large future with a size of 49159 bytes
--> tests/ui/large_futures.rs:35:5
--> tests/ui/large_futures.rs:38:5
|
LL | calls_fut(fut).await;
| ^^^^^^^^^^^^^^ help: consider `Box::pin` on it: `Box::pin(calls_fut(fut))`
error: large future with a size of 65540 bytes
--> tests/ui/large_futures.rs:48:5
--> tests/ui/large_futures.rs:51:5
|
LL | / async {
LL | |
@ -61,7 +61,7 @@ LL + })
|
error: large future with a size of 65540 bytes
--> tests/ui/large_futures.rs:61:13
--> tests/ui/large_futures.rs:64:13
|
LL | / async {
LL | |

View file

@ -1,5 +1,5 @@
#![warn(clippy::manual_inspect)]
#![allow(clippy::no_effect, clippy::op_ref, clippy::uninlined_format_args)]
#![warn(clippy::manual_inspect)]
fn main() {
let _ = Some(0).inspect(|&x| {

View file

@ -1,5 +1,5 @@
#![warn(clippy::manual_inspect)]
#![allow(clippy::no_effect, clippy::op_ref, clippy::uninlined_format_args)]
#![warn(clippy::manual_inspect)]
fn main() {
let _ = Some(0).map(|x| {

View file

@ -1,3 +1,5 @@
//@no-rustfix
#![allow(
clippy::if_same_then_else,
clippy::no_effect,
@ -6,8 +8,9 @@
clippy::uninlined_format_args
)]
#![warn(clippy::needless_pass_by_ref_mut)]
//@no-rustfix
use std::ptr::NonNull;
fn foo(s: &mut Vec<u32>, b: &u32, x: &mut u32) {
//~^ needless_pass_by_ref_mut

View file

@ -1,5 +1,5 @@
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:11:11
--> tests/ui/needless_pass_by_ref_mut.rs:14:11
|
LL | fn foo(s: &mut Vec<u32>, b: &u32, x: &mut u32) {
| ^^^^^^^^^^^^^ help: consider changing to: `&Vec<u32>`
@ -8,79 +8,79 @@ LL | fn foo(s: &mut Vec<u32>, b: &u32, x: &mut u32) {
= help: to override `-D warnings` add `#[allow(clippy::needless_pass_by_ref_mut)]`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:37:12
--> tests/ui/needless_pass_by_ref_mut.rs:40:12
|
LL | fn foo6(s: &mut Vec<u32>) {
| ^^^^^^^^^^^^^ help: consider changing to: `&Vec<u32>`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:48:12
--> tests/ui/needless_pass_by_ref_mut.rs:51:12
|
LL | fn bar(&mut self) {}
| ^^^^^^^^^ help: consider changing to: `&self`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:51:29
--> tests/ui/needless_pass_by_ref_mut.rs:54:29
|
LL | fn mushroom(&self, vec: &mut Vec<i32>) -> usize {
| ^^^^^^^^^^^^^ help: consider changing to: `&Vec<i32>`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:129:16
--> tests/ui/needless_pass_by_ref_mut.rs:132:16
|
LL | async fn a1(x: &mut i32) {
| ^^^^^^^^ help: consider changing to: `&i32`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:134:16
--> tests/ui/needless_pass_by_ref_mut.rs:137:16
|
LL | async fn a2(x: &mut i32, y: String) {
| ^^^^^^^^ help: consider changing to: `&i32`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:139:16
--> tests/ui/needless_pass_by_ref_mut.rs:142:16
|
LL | async fn a3(x: &mut i32, y: String, z: String) {
| ^^^^^^^^ help: consider changing to: `&i32`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:144:16
--> tests/ui/needless_pass_by_ref_mut.rs:147:16
|
LL | async fn a4(x: &mut i32, y: i32) {
| ^^^^^^^^ help: consider changing to: `&i32`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:149:24
--> tests/ui/needless_pass_by_ref_mut.rs:152:24
|
LL | async fn a5(x: i32, y: &mut i32) {
| ^^^^^^^^ help: consider changing to: `&i32`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:154:24
--> tests/ui/needless_pass_by_ref_mut.rs:157:24
|
LL | async fn a6(x: i32, y: &mut i32) {
| ^^^^^^^^ help: consider changing to: `&i32`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:159:32
--> tests/ui/needless_pass_by_ref_mut.rs:162:32
|
LL | async fn a7(x: i32, y: i32, z: &mut i32) {
| ^^^^^^^^ help: consider changing to: `&i32`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:164:24
--> tests/ui/needless_pass_by_ref_mut.rs:167:24
|
LL | async fn a8(x: i32, a: &mut i32, y: i32, z: &mut i32) {
| ^^^^^^^^ help: consider changing to: `&i32`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:164:45
--> tests/ui/needless_pass_by_ref_mut.rs:167:45
|
LL | async fn a8(x: i32, a: &mut i32, y: i32, z: &mut i32) {
| ^^^^^^^^ help: consider changing to: `&i32`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:200:16
--> tests/ui/needless_pass_by_ref_mut.rs:203:16
|
LL | fn cfg_warn(s: &mut u32) {}
| ^^^^^^^^ help: consider changing to: `&u32`
@ -88,7 +88,7 @@ LL | fn cfg_warn(s: &mut u32) {}
= note: this is cfg-gated and may require further changes
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:205:20
--> tests/ui/needless_pass_by_ref_mut.rs:208:20
|
LL | fn cfg_warn(s: &mut u32) {}
| ^^^^^^^^ help: consider changing to: `&u32`
@ -96,115 +96,115 @@ LL | fn cfg_warn(s: &mut u32) {}
= note: this is cfg-gated and may require further changes
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:218:39
--> tests/ui/needless_pass_by_ref_mut.rs:221:39
|
LL | async fn inner_async2(x: &mut i32, y: &mut u32) {
| ^^^^^^^^ help: consider changing to: `&u32`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:227:26
--> tests/ui/needless_pass_by_ref_mut.rs:230:26
|
LL | async fn inner_async3(x: &mut i32, y: &mut u32) {
| ^^^^^^^^ help: consider changing to: `&i32`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:247:30
--> tests/ui/needless_pass_by_ref_mut.rs:250:30
|
LL | async fn call_in_closure1(n: &mut str) {
| ^^^^^^^^ help: consider changing to: `&str`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:267:16
--> tests/ui/needless_pass_by_ref_mut.rs:270:16
|
LL | fn closure2(n: &mut usize) -> impl '_ + FnMut() -> usize {
| ^^^^^^^^^^ help: consider changing to: `&usize`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:279:22
--> tests/ui/needless_pass_by_ref_mut.rs:282:22
|
LL | async fn closure4(n: &mut usize) {
| ^^^^^^^^^^ help: consider changing to: `&usize`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:334:12
--> tests/ui/needless_pass_by_ref_mut.rs:337:12
|
LL | fn bar(&mut self) {}
| ^^^^^^^^^ help: consider changing to: `&self`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:337:18
--> tests/ui/needless_pass_by_ref_mut.rs:340:18
|
LL | async fn foo(&mut self, u: &mut i32, v: &mut u32) {
| ^^^^^^^^^ help: consider changing to: `&self`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:337:45
--> tests/ui/needless_pass_by_ref_mut.rs:340:45
|
LL | async fn foo(&mut self, u: &mut i32, v: &mut u32) {
| ^^^^^^^^ help: consider changing to: `&u32`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:346:46
--> tests/ui/needless_pass_by_ref_mut.rs:349:46
|
LL | async fn foo2(&mut self, u: &mut i32, v: &mut u32) {
| ^^^^^^^^ help: consider changing to: `&u32`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:363:18
--> tests/ui/needless_pass_by_ref_mut.rs:366:18
|
LL | fn _empty_tup(x: &mut (())) {}
| ^^^^^^^^^ help: consider changing to: `&()`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:365:19
--> tests/ui/needless_pass_by_ref_mut.rs:368:19
|
LL | fn _single_tup(x: &mut ((i32,))) {}
| ^^^^^^^^^^^^^ help: consider changing to: `&(i32,)`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:367:18
--> tests/ui/needless_pass_by_ref_mut.rs:370:18
|
LL | fn _multi_tup(x: &mut ((i32, u32))) {}
| ^^^^^^^^^^^^^^^^^ help: consider changing to: `&(i32, u32)`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:369:11
--> tests/ui/needless_pass_by_ref_mut.rs:372:11
|
LL | fn _fn(x: &mut (fn())) {}
| ^^^^^^^^^^^ help: consider changing to: `&fn()`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:372:23
--> tests/ui/needless_pass_by_ref_mut.rs:375:23
|
LL | fn _extern_rust_fn(x: &mut extern "Rust" fn()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&extern "Rust" fn()`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:374:20
--> tests/ui/needless_pass_by_ref_mut.rs:377:20
|
LL | fn _extern_c_fn(x: &mut extern "C" fn()) {}
| ^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&extern "C" fn()`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:376:18
--> tests/ui/needless_pass_by_ref_mut.rs:379:18
|
LL | fn _unsafe_fn(x: &mut unsafe fn()) {}
| ^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe fn()`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:378:25
--> tests/ui/needless_pass_by_ref_mut.rs:381:25
|
LL | fn _unsafe_extern_fn(x: &mut unsafe extern "C" fn()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe extern "C" fn()`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:380:20
--> tests/ui/needless_pass_by_ref_mut.rs:383:20
|
LL | fn _fn_with_arg(x: &mut unsafe extern "C" fn(i32)) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe extern "C" fn(i32)`
error: this argument is a mutable reference, but not used mutably
--> tests/ui/needless_pass_by_ref_mut.rs:382:20
--> tests/ui/needless_pass_by_ref_mut.rs:385:20
|
LL | fn _fn_with_ret(x: &mut unsafe extern "C" fn() -> (i32)) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe extern "C" fn() -> (i32)`

View file

@ -1,5 +1,7 @@
//@compile-flags: -C incremental=target/debug/test/incr
#![allow(clippy::uninlined_format_args)]
// see https://github.com/rust-lang/rust-clippy/issues/10969
fn main() {

View file

@ -1,5 +1,7 @@
//@compile-flags: -C incremental=target/debug/test/incr
#![allow(clippy::uninlined_format_args)]
// see https://github.com/rust-lang/rust-clippy/issues/10969
fn main() {

View file

@ -1,5 +1,5 @@
error: `to_string` applied to a type that implements `Display` in `println!` args
--> tests/ui/to_string_in_format_args_incremental.rs:7:21
--> tests/ui/to_string_in_format_args_incremental.rs:9:21
|
LL | println!("{}", s.to_string());
| ^^^^^^^^^^^^ help: remove this

View file

@ -1,12 +1,13 @@
#![allow(
clippy::deref_addrof,
dead_code,
unused,
clippy::no_effect,
clippy::unnecessary_struct_initialization
clippy::uninlined_format_args,
clippy::unnecessary_struct_initialization,
dead_code,
unused
)]
#![warn(clippy::unnecessary_operation)]
#![allow(clippy::uninlined_format_args)]
use std::fmt::Display;
use std::ops::Shl;

View file

@ -1,12 +1,13 @@
#![allow(
clippy::deref_addrof,
dead_code,
unused,
clippy::no_effect,
clippy::unnecessary_struct_initialization
clippy::uninlined_format_args,
clippy::unnecessary_struct_initialization,
dead_code,
unused
)]
#![warn(clippy::unnecessary_operation)]
#![allow(clippy::uninlined_format_args)]
use std::fmt::Display;
use std::ops::Shl;

View file

@ -1,5 +1,5 @@
error: unnecessary operation
--> tests/ui/unnecessary_operation.rs:70:5
--> tests/ui/unnecessary_operation.rs:71:5
|
LL | Tuple(get_number());
| ^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();`
@ -8,103 +8,103 @@ LL | Tuple(get_number());
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_operation)]`
error: unnecessary operation
--> tests/ui/unnecessary_operation.rs:72:5
--> tests/ui/unnecessary_operation.rs:73:5
|
LL | Struct { field: get_number() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();`
error: unnecessary operation
--> tests/ui/unnecessary_operation.rs:74:5
--> tests/ui/unnecessary_operation.rs:75:5
|
LL | Struct { ..get_struct() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_struct();`
error: unnecessary operation
--> tests/ui/unnecessary_operation.rs:76:5
--> tests/ui/unnecessary_operation.rs:77:5
|
LL | Enum::Tuple(get_number());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();`
error: unnecessary operation
--> tests/ui/unnecessary_operation.rs:78:5
--> tests/ui/unnecessary_operation.rs:79:5
|
LL | Enum::Struct { field: get_number() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();`
error: unnecessary operation
--> tests/ui/unnecessary_operation.rs:80:5
--> tests/ui/unnecessary_operation.rs:81:5
|
LL | 5 + get_number();
| ^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `5;get_number();`
error: unnecessary operation
--> tests/ui/unnecessary_operation.rs:82:5
--> tests/ui/unnecessary_operation.rs:83:5
|
LL | *&get_number();
| ^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();`
error: unnecessary operation
--> tests/ui/unnecessary_operation.rs:84:5
--> tests/ui/unnecessary_operation.rs:85:5
|
LL | &get_number();
| ^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();`
error: unnecessary operation
--> tests/ui/unnecessary_operation.rs:86:5
--> tests/ui/unnecessary_operation.rs:87:5
|
LL | (5, 6, get_number());
| ^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `5;6;get_number();`
error: unnecessary operation
--> tests/ui/unnecessary_operation.rs:88:5
--> tests/ui/unnecessary_operation.rs:89:5
|
LL | get_number()..;
| ^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();`
error: unnecessary operation
--> tests/ui/unnecessary_operation.rs:90:5
--> tests/ui/unnecessary_operation.rs:91:5
|
LL | ..get_number();
| ^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();`
error: unnecessary operation
--> tests/ui/unnecessary_operation.rs:92:5
--> tests/ui/unnecessary_operation.rs:93:5
|
LL | 5..get_number();
| ^^^^^^^^^^^^^^^^ help: statement can be reduced to: `5;get_number();`
error: unnecessary operation
--> tests/ui/unnecessary_operation.rs:94:5
--> tests/ui/unnecessary_operation.rs:95:5
|
LL | [42, get_number()];
| ^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `42;get_number();`
error: unnecessary operation
--> tests/ui/unnecessary_operation.rs:96:5
--> tests/ui/unnecessary_operation.rs:97:5
|
LL | [42, 55][get_usize()];
| ^^^^^^^^^^^^^^^^^^^^^^ help: statement can be written as: `assert!([42, 55].len() > get_usize());`
error: unnecessary operation
--> tests/ui/unnecessary_operation.rs:98:5
--> tests/ui/unnecessary_operation.rs:99:5
|
LL | (42, get_number()).1;
| ^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `42;get_number();`
error: unnecessary operation
--> tests/ui/unnecessary_operation.rs:100:5
--> tests/ui/unnecessary_operation.rs:101:5
|
LL | [get_number(); 55];
| ^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `get_number();`
error: unnecessary operation
--> tests/ui/unnecessary_operation.rs:102:5
--> tests/ui/unnecessary_operation.rs:103:5
|
LL | [42; 55][get_usize()];
| ^^^^^^^^^^^^^^^^^^^^^^ help: statement can be written as: `assert!([42; 55].len() > get_usize());`
error: unnecessary operation
--> tests/ui/unnecessary_operation.rs:104:5
--> tests/ui/unnecessary_operation.rs:105:5
|
LL | / {
LL | |
@ -113,7 +113,7 @@ LL | | };
| |______^ help: statement can be reduced to: `get_number();`
error: unnecessary operation
--> tests/ui/unnecessary_operation.rs:108:5
--> tests/ui/unnecessary_operation.rs:109:5
|
LL | / FooString {
LL | |
@ -122,7 +122,7 @@ LL | | };
| |______^ help: statement can be reduced to: `String::from("blah");`
error: unnecessary operation
--> tests/ui/unnecessary_operation.rs:149:5
--> tests/ui/unnecessary_operation.rs:150:5
|
LL | [42, 55][get_usize()];
| ^^^^^^^^^^^^^^^^^^^^^^ help: statement can be written as: `assert!([42, 55].len() > get_usize());`

View file

@ -1,13 +1,13 @@
#![allow(
clippy::manual_async_fn,
clippy::needless_borrow,
clippy::needless_borrows_for_generic_args,
clippy::ptr_arg,
clippy::manual_async_fn,
clippy::needless_lifetimes,
clippy::owned_cow
clippy::owned_cow,
clippy::ptr_arg
)]
#![warn(clippy::unnecessary_to_owned, clippy::redundant_clone)]
#![allow(clippy::uninlined_format_args)]
use std::borrow::Cow;
use std::ffi::{CStr, CString, OsStr, OsString};
use std::ops::Deref;