|  | 
| 1 |  | -error: function or method calls as the initial value in zero-sized array initializers may cause side effects | 
| 2 |  | -  --> tests/ui/zero_repeat_side_effects.rs:18:5 | 
|  | 1 | +error: expression with side effects as the initial value in a zero-sized array initializer | 
|  | 2 | +  --> tests/ui/zero_repeat_side_effects.rs:16:5 | 
| 3 | 3 |    | | 
| 4 | 4 | LL |     let a = [f(); 0]; | 
| 5 |  | -   |     ^^^^^^^^^^^^^^^^^ help: consider using: `f(); let a: [i32; 0] = [];` | 
|  | 5 | +   |     ^^^^^^^^^^^^^^^^^ | 
| 6 | 6 |    | | 
| 7 | 7 |    = note: `-D clippy::zero-repeat-side-effects` implied by `-D warnings` | 
| 8 | 8 |    = help: to override `-D warnings` add `#[allow(clippy::zero_repeat_side_effects)]` | 
|  | 9 | +help: consider performing the side effect separately | 
|  | 10 | +   | | 
|  | 11 | +LL -     let a = [f(); 0]; | 
|  | 12 | +LL +     f(); let a: [i32; 0] = []; | 
|  | 13 | +   | | 
| 9 | 14 | 
 | 
| 10 |  | -error: function or method calls as the initial value in zero-sized array initializers may cause side effects | 
| 11 |  | -  --> tests/ui/zero_repeat_side_effects.rs:21:5 | 
|  | 15 | +error: expression with side effects as the initial value in a zero-sized array initializer | 
|  | 16 | +  --> tests/ui/zero_repeat_side_effects.rs:19:5 | 
| 12 | 17 |    | | 
| 13 | 18 | LL |     b = [f(); 0]; | 
| 14 |  | -   |     ^^^^^^^^^^^^ help: consider using: `f(); b = [] as [i32; 0]` | 
|  | 19 | +   |     ^^^^^^^^^^^^ | 
|  | 20 | +   | | 
|  | 21 | +help: consider performing the side effect separately | 
|  | 22 | +   | | 
|  | 23 | +LL -     b = [f(); 0]; | 
|  | 24 | +LL +     f(); b = [] as [i32; 0]; | 
|  | 25 | +   | | 
| 15 | 26 | 
 | 
| 16 |  | -error: function or method calls as the initial value in zero-sized array initializers may cause side effects | 
| 17 |  | -  --> tests/ui/zero_repeat_side_effects.rs:26:5 | 
|  | 27 | +error: expression with side effects as the initial value in a zero-sized array initializer | 
|  | 28 | +  --> tests/ui/zero_repeat_side_effects.rs:24:5 | 
| 18 | 29 |    | | 
| 19 | 30 | LL |     let c = vec![f(); 0]; | 
| 20 |  | -   |     ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f(); let c: std::vec::Vec<i32> = vec![];` | 
|  | 31 | +   |     ^^^^^^^^^^^^^^^^^^^^^ | 
|  | 32 | +   | | 
|  | 33 | +help: consider performing the side effect separately | 
|  | 34 | +   | | 
|  | 35 | +LL -     let c = vec![f(); 0]; | 
|  | 36 | +LL +     f(); let c: std::vec::Vec<i32> = vec![]; | 
|  | 37 | +   | | 
| 21 | 38 | 
 | 
| 22 |  | -error: function or method calls as the initial value in zero-sized array initializers may cause side effects | 
| 23 |  | -  --> tests/ui/zero_repeat_side_effects.rs:29:5 | 
|  | 39 | +error: expression with side effects as the initial value in a zero-sized array initializer | 
|  | 40 | +  --> tests/ui/zero_repeat_side_effects.rs:27:5 | 
| 24 | 41 |    | | 
| 25 | 42 | LL |     d = vec![f(); 0]; | 
| 26 |  | -   |     ^^^^^^^^^^^^^^^^ help: consider using: `f(); d = vec![] as std::vec::Vec<i32>` | 
|  | 43 | +   |     ^^^^^^^^^^^^^^^^ | 
|  | 44 | +   | | 
|  | 45 | +help: consider performing the side effect separately | 
|  | 46 | +   | | 
|  | 47 | +LL -     d = vec![f(); 0]; | 
|  | 48 | +LL +     f(); d = vec![] as std::vec::Vec<i32>; | 
|  | 49 | +   | | 
| 27 | 50 | 
 | 
| 28 |  | -error: function or method calls as the initial value in zero-sized array initializers may cause side effects | 
| 29 |  | -  --> tests/ui/zero_repeat_side_effects.rs:33:5 | 
|  | 51 | +error: expression with side effects as the initial value in a zero-sized array initializer | 
|  | 52 | +  --> tests/ui/zero_repeat_side_effects.rs:31:5 | 
| 30 | 53 |    | | 
| 31 | 54 | LL |     let e = [println!("side effect"); 0]; | 
| 32 |  | -   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `println!("side effect"); let e: [(); 0] = [];` | 
|  | 55 | +   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | 
|  | 56 | +   | | 
|  | 57 | +help: consider performing the side effect separately | 
|  | 58 | +   | | 
|  | 59 | +LL -     let e = [println!("side effect"); 0]; | 
|  | 60 | +LL +     println!("side effect"); let e: [(); 0] = []; | 
|  | 61 | +   | | 
| 33 | 62 | 
 | 
| 34 |  | -error: function or method calls as the initial value in zero-sized array initializers may cause side effects | 
| 35 |  | -  --> tests/ui/zero_repeat_side_effects.rs:37:5 | 
|  | 63 | +error: expression with side effects as the initial value in a zero-sized array initializer | 
|  | 64 | +  --> tests/ui/zero_repeat_side_effects.rs:35:5 | 
| 36 | 65 |    | | 
| 37 | 66 | LL |     let g = [{ f() }; 0]; | 
| 38 |  | -   |     ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `{ f() }; let g: [i32; 0] = [];` | 
|  | 67 | +   |     ^^^^^^^^^^^^^^^^^^^^^ | 
|  | 68 | +   | | 
|  | 69 | +help: consider performing the side effect separately | 
|  | 70 | +   | | 
|  | 71 | +LL -     let g = [{ f() }; 0]; | 
|  | 72 | +LL +     { f() }; let g: [i32; 0] = []; | 
|  | 73 | +   | | 
| 39 | 74 | 
 | 
| 40 |  | -error: function or method calls as the initial value in zero-sized array initializers may cause side effects | 
| 41 |  | -  --> tests/ui/zero_repeat_side_effects.rs:41:10 | 
|  | 75 | +error: expression with side effects as the initial value in a zero-sized array initializer | 
|  | 76 | +  --> tests/ui/zero_repeat_side_effects.rs:39:10 | 
| 42 | 77 |    | | 
| 43 | 78 | LL |     drop(vec![f(); 0]); | 
| 44 |  | -   |          ^^^^^^^^^^^^ help: consider using: `{ f(); vec![] as std::vec::Vec<i32> }` | 
|  | 79 | +   |          ^^^^^^^^^^^^ | 
|  | 80 | +   | | 
|  | 81 | +help: consider performing the side effect separately | 
|  | 82 | +   | | 
|  | 83 | +LL -     drop(vec![f(); 0]); | 
|  | 84 | +LL +     drop({ f(); vec![] as std::vec::Vec<i32> }); | 
|  | 85 | +   | | 
| 45 | 86 | 
 | 
| 46 |  | -error: function or method calls as the initial value in zero-sized array initializers may cause side effects | 
| 47 |  | -  --> tests/ui/zero_repeat_side_effects.rs:45:5 | 
|  | 87 | +error: expression with side effects as the initial value in a zero-sized array initializer | 
|  | 88 | +  --> tests/ui/zero_repeat_side_effects.rs:43:5 | 
| 48 | 89 |    | | 
| 49 | 90 | LL |     vec![f(); 0]; | 
| 50 |  | -   |     ^^^^^^^^^^^^ help: consider using: `{ f(); vec![] as std::vec::Vec<i32> }` | 
|  | 91 | +   |     ^^^^^^^^^^^^ | 
|  | 92 | +   | | 
|  | 93 | +help: consider performing the side effect separately | 
|  | 94 | +   | | 
|  | 95 | +LL -     vec![f(); 0]; | 
|  | 96 | +LL +     { f(); vec![] as std::vec::Vec<i32> }; | 
|  | 97 | +   | | 
| 51 | 98 | 
 | 
| 52 |  | -error: function or method calls as the initial value in zero-sized array initializers may cause side effects | 
| 53 |  | -  --> tests/ui/zero_repeat_side_effects.rs:47:5 | 
|  | 99 | +error: expression with side effects as the initial value in a zero-sized array initializer | 
|  | 100 | +  --> tests/ui/zero_repeat_side_effects.rs:45:5 | 
| 54 | 101 |    | | 
| 55 | 102 | LL |     [f(); 0]; | 
| 56 |  | -   |     ^^^^^^^^ help: consider using: `{ f(); [] as [i32; 0] }` | 
|  | 103 | +   |     ^^^^^^^^ | 
|  | 104 | +   | | 
|  | 105 | +help: consider performing the side effect separately | 
|  | 106 | +   | | 
|  | 107 | +LL -     [f(); 0]; | 
|  | 108 | +LL +     { f(); [] as [i32; 0] }; | 
|  | 109 | +   | | 
|  | 110 | + | 
|  | 111 | +error: expression with side effects as the initial value in a zero-sized array initializer | 
|  | 112 | +  --> tests/ui/zero_repeat_side_effects.rs:99:10 | 
|  | 113 | +   | | 
|  | 114 | +LL |     foo(&[Some(f()); 0]); | 
|  | 115 | +   |          ^^^^^^^^^^^^^^ | 
|  | 116 | +   | | 
|  | 117 | +help: consider performing the side effect separately | 
|  | 118 | +   | | 
|  | 119 | +LL -     foo(&[Some(f()); 0]); | 
|  | 120 | +LL +     foo(&{ Some(f()); [] as [std::option::Option<i32>; 0] }); | 
|  | 121 | +   | | 
|  | 122 | + | 
|  | 123 | +error: expression with side effects as the initial value in a zero-sized array initializer | 
|  | 124 | +  --> tests/ui/zero_repeat_side_effects.rs:101:10 | 
|  | 125 | +   | | 
|  | 126 | +LL |     foo(&[Some(Some(S::new())); 0]); | 
|  | 127 | +   |          ^^^^^^^^^^^^^^^^^^^^^^^^^ | 
|  | 128 | +   | | 
|  | 129 | +help: consider performing the side effect separately | 
|  | 130 | +   | | 
|  | 131 | +LL -     foo(&[Some(Some(S::new())); 0]); | 
|  | 132 | +LL +     foo(&{ Some(Some(S::new())); [] as [std::option::Option<std::option::Option<S>>; 0] }); | 
|  | 133 | +   | | 
| 57 | 134 | 
 | 
| 58 |  | -error: aborting due to 9 previous errors | 
|  | 135 | +error: aborting due to 11 previous errors | 
| 59 | 136 | 
 | 
0 commit comments