@@ -137,40 +137,6 @@ declare_clippy_lint! {
137137 "transmutes from a pointer to a reference type"
138138}
139139
140- declare_clippy_lint ! {
141- /// ### What it does
142- /// Checks for transmutes from an integer to a `char`.
143- ///
144- /// ### Why is this bad?
145- /// Not every integer is a Unicode scalar value.
146- ///
147- /// ### Known problems
148- /// - [`from_u32`] which this lint suggests using is slower than `transmute`
149- /// as it needs to validate the input.
150- /// If you are certain that the input is always a valid Unicode scalar value,
151- /// use [`from_u32_unchecked`] which is as fast as `transmute`
152- /// but has a semantically meaningful name.
153- /// - You might want to handle `None` returned from [`from_u32`] instead of calling `unwrap`.
154- ///
155- /// [`from_u32`]: https://doc.rust-lang.org/std/char/fn.from_u32.html
156- /// [`from_u32_unchecked`]: https://doc.rust-lang.org/std/char/fn.from_u32_unchecked.html
157- ///
158- /// ### Example
159- /// ```no_run
160- /// let x = 1_u32;
161- /// unsafe {
162- /// let _: char = std::mem::transmute(x); // where x: u32
163- /// }
164- ///
165- /// // should be:
166- /// let _ = std::char::from_u32(x).unwrap();
167- /// ```
168- #[ clippy:: version = "pre 1.29.0" ]
169- pub TRANSMUTE_INT_TO_CHAR ,
170- complexity,
171- "transmutes from an integer to a `char`"
172- }
173-
174140declare_clippy_lint ! {
175141 /// ### What it does
176142 /// Checks for transmutes from a `&[u8]` to a `&str`.
@@ -228,29 +194,6 @@ declare_clippy_lint! {
228194 "transmutes from an integer to a `bool`"
229195}
230196
231- declare_clippy_lint ! {
232- /// ### What it does
233- /// Checks for transmutes from an integer to a float.
234- ///
235- /// ### Why is this bad?
236- /// Transmutes are dangerous and error-prone, whereas `from_bits` is intuitive
237- /// and safe.
238- ///
239- /// ### Example
240- /// ```no_run
241- /// unsafe {
242- /// let _: f32 = std::mem::transmute(1_u32); // where x: u32
243- /// }
244- ///
245- /// // should be:
246- /// let _: f32 = f32::from_bits(1_u32);
247- /// ```
248- #[ clippy:: version = "pre 1.29.0" ]
249- pub TRANSMUTE_INT_TO_FLOAT ,
250- complexity,
251- "transmutes from an integer to a float"
252- }
253-
254197declare_clippy_lint ! {
255198 /// ### What it does
256199 /// Checks for transmutes from `T` to `NonZero<T>`, and suggests the `new_unchecked`
@@ -276,29 +219,6 @@ declare_clippy_lint! {
276219 "transmutes from an integer to a non-zero wrapper"
277220}
278221
279- declare_clippy_lint ! {
280- /// ### What it does
281- /// Checks for transmutes from a float to an integer.
282- ///
283- /// ### Why is this bad?
284- /// Transmutes are dangerous and error-prone, whereas `to_bits` is intuitive
285- /// and safe.
286- ///
287- /// ### Example
288- /// ```no_run
289- /// unsafe {
290- /// let _: u32 = std::mem::transmute(1f32);
291- /// }
292- ///
293- /// // should be:
294- /// let _: u32 = 1f32.to_bits();
295- /// ```
296- #[ clippy:: version = "1.41.0" ]
297- pub TRANSMUTE_FLOAT_TO_INT ,
298- complexity,
299- "transmutes from a float to an integer"
300- }
301-
302222declare_clippy_lint ! {
303223 /// ### What it does
304224 /// Checks for transmutes from a number to an array of `u8`
@@ -577,12 +497,9 @@ impl_lint_pass!(Transmute => [
577497 TRANSMUTE_PTR_TO_PTR ,
578498 USELESS_TRANSMUTE ,
579499 WRONG_TRANSMUTE ,
580- TRANSMUTE_INT_TO_CHAR ,
581500 TRANSMUTE_BYTES_TO_STR ,
582501 TRANSMUTE_INT_TO_BOOL ,
583- TRANSMUTE_INT_TO_FLOAT ,
584502 TRANSMUTE_INT_TO_NON_ZERO ,
585- TRANSMUTE_FLOAT_TO_INT ,
586503 TRANSMUTE_NUM_TO_BYTES ,
587504 UNSOUND_COLLECTION_TRANSMUTE ,
588505 TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS ,
0 commit comments