diff --git a/tests/ui/unnecessary_operation.fixed b/tests/ui/unnecessary_operation.fixed index 006f123cbcdf..014166ac4a08 100644 --- a/tests/ui/unnecessary_operation.fixed +++ b/tests/ui/unnecessary_operation.fixed @@ -114,7 +114,7 @@ fn main() { break 'label }; let () = const { - [42, 55][get_usize()]; + assert!([42, 55].len() > get_usize()); }; } diff --git a/tests/ui/unnecessary_operation.stderr b/tests/ui/unnecessary_operation.stderr index 036a9a44bbad..5ee042ed8404 100644 --- a/tests/ui/unnecessary_operation.stderr +++ b/tests/ui/unnecessary_operation.stderr @@ -119,11 +119,17 @@ LL | | s: String::from("blah"), LL | | }; | |______^ help: statement can be reduced to: `String::from("blah");` +error: unnecessary operation + --> tests/ui/unnecessary_operation.rs:121:9 + | +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:130:5 | LL | [42, 55][get_usize()]; | ^^^^^^^^^^^^^^^^^^^^^^ help: statement can be written as: `assert!([42, 55].len() > get_usize());` -error: aborting due to 20 previous errors +error: aborting due to 21 previous errors