1 error: trivial numeric cast: `i32` as `i32`
2 --> $DIR/trivial_casts.rs:16:13
4 LL | let _ = 42_i32 as i32;
7 note: lint level defined here
8 --> $DIR/trivial_casts.rs:4:24
10 LL | #![deny(trivial_casts, trivial_numeric_casts)]
11 | ^^^^^^^^^^^^^^^^^^^^^
12 = help: cast can be replaced by coercion; this might require a temporary variable
14 error: trivial numeric cast: `u8` as `u8`
15 --> $DIR/trivial_casts.rs:19:13
17 LL | let _ = 42_u8 as u8;
20 = help: cast can be replaced by coercion; this might require a temporary variable
22 error: trivial cast: `&u32` as `*const u32`
23 --> $DIR/trivial_casts.rs:24:13
25 LL | let _ = x as *const u32;
28 note: lint level defined here
29 --> $DIR/trivial_casts.rs:4:9
31 LL | #![deny(trivial_casts, trivial_numeric_casts)]
33 = help: cast can be replaced by coercion; this might require a temporary variable
35 error: trivial cast: `&mut u32` as `*mut u32`
36 --> $DIR/trivial_casts.rs:28:13
38 LL | let _ = x as *mut u32;
41 = help: cast can be replaced by coercion; this might require a temporary variable
43 error: trivial cast: `&[u32; 3]` as `&[u32]`
44 --> $DIR/trivial_casts.rs:33:13
46 LL | let _ = x as &[u32];
49 = help: cast can be replaced by coercion; this might require a temporary variable
51 error: trivial cast: `&[u32; 3]` as `*const [u32]`
52 --> $DIR/trivial_casts.rs:34:13
54 LL | let _ = x as *const [u32];
57 = help: cast can be replaced by coercion; this might require a temporary variable
59 error: trivial cast: `&mut [u32; 3]` as `&mut [u32]`
60 --> $DIR/trivial_casts.rs:39:13
62 LL | let _ = x as &mut [u32];
65 = help: cast can be replaced by coercion; this might require a temporary variable
67 error: trivial cast: `&mut [u32; 3]` as `*mut [u32]`
68 --> $DIR/trivial_casts.rs:40:13
70 LL | let _ = x as *mut [u32];
73 = help: cast can be replaced by coercion; this might require a temporary variable
75 error: trivial cast: `std::boxed::Box<[u32; 3]>` as `std::boxed::Box<[u32]>`
76 --> $DIR/trivial_casts.rs:45:13
78 LL | let _ = x as Box<[u32]>;
81 = help: cast can be replaced by coercion; this might require a temporary variable
83 error: trivial cast: `&Bar` as `&dyn Foo`
84 --> $DIR/trivial_casts.rs:52:13
86 LL | let _ = x as &dyn Foo;
89 = help: cast can be replaced by coercion; this might require a temporary variable
91 error: trivial cast: `&Bar` as `*const dyn Foo`
92 --> $DIR/trivial_casts.rs:53:13
94 LL | let _ = x as *const dyn Foo;
97 = help: cast can be replaced by coercion; this might require a temporary variable
99 error: trivial cast: `&mut Bar` as `&mut dyn Foo`
100 --> $DIR/trivial_casts.rs:58:13
102 LL | let _ = x as &mut dyn Foo;
105 = help: cast can be replaced by coercion; this might require a temporary variable
107 error: trivial cast: `&mut Bar` as `*mut dyn Foo`
108 --> $DIR/trivial_casts.rs:59:13
110 LL | let _ = x as *mut dyn Foo;
113 = help: cast can be replaced by coercion; this might require a temporary variable
115 error: trivial cast: `std::boxed::Box<Bar>` as `std::boxed::Box<dyn Foo>`
116 --> $DIR/trivial_casts.rs:64:13
118 LL | let _ = x as Box<dyn Foo>;
121 = help: cast can be replaced by coercion; this might require a temporary variable
123 error: trivial cast: `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)`
124 --> $DIR/trivial_casts.rs:70:13
126 LL | let _ = &baz as &dyn Fn(i32);
127 | ^^^^^^^^^^^^^^^^^^^^
129 = help: cast can be replaced by coercion; this might require a temporary variable
131 error: trivial cast: `&[closure@$DIR/trivial_casts.rs:72:13: 72:25]` as `&dyn std::ops::Fn(i32)`
132 --> $DIR/trivial_casts.rs:73:13
134 LL | let _ = &x as &dyn Fn(i32);
137 = help: cast can be replaced by coercion; this might require a temporary variable
139 error: trivial cast: `&'a Bar` as `&'a Bar`
140 --> $DIR/trivial_casts.rs:79:13
142 LL | let _ = a as &'a Bar;
145 = help: cast can be replaced by coercion; this might require a temporary variable
147 error: trivial cast: `&'b Bar` as `&'a Bar`
148 --> $DIR/trivial_casts.rs:81:13
150 LL | let _ = b as &'a Bar;
153 = help: cast can be replaced by coercion; this might require a temporary variable
155 error: trivial cast: `&'b Bar` as `&'b Bar`
156 --> $DIR/trivial_casts.rs:83:13
158 LL | let _ = b as &'b Bar;
161 = help: cast can be replaced by coercion; this might require a temporary variable
163 error: aborting due to 19 previous errors