Fix indent in E0591.md

This commit is contained in:
reddevilmidzy 2025-11-30 20:29:26 +09:00
parent cc3eee7fbe
commit d4af0f0772
2 changed files with 12 additions and 12 deletions

View file

@ -62,14 +62,14 @@ This pattern should be rewritten. There are a few possible ways to do this:
and do the cast in the fn body (the preferred option)
- cast the fn item of a fn pointer before calling transmute, as shown here:
```
# extern "C" fn foo(_: Box<i32>) {}
# use std::mem::transmute;
# unsafe {
let f: extern "C" fn(*mut i32) = transmute(foo as extern "C" fn(_));
let f: extern "C" fn(*mut i32) = transmute(foo as usize); // works too
# }
```
```
# extern "C" fn foo(_: Box<i32>) {}
# use std::mem::transmute;
# unsafe {
let f: extern "C" fn(*mut i32) = transmute(foo as extern "C" fn(_));
let f: extern "C" fn(*mut i32) = transmute(foo as usize); // works too
# }
```
The same applies to transmutes to `*mut fn()`, which were observed in practice.
Note though that use of this type is generally incorrect.

View file

@ -56,10 +56,10 @@ This pattern should be rewritten. There are a few possible ways to do this:
and do the cast in the fn body (the preferred option)
- cast the fn item of a fn pointer before calling transmute, as shown here:
```
let f: extern "C" fn(*mut i32) = transmute(foo as extern "C" fn(_));
let f: extern "C" fn(*mut i32) = transmute(foo as usize); // works too
```
```
let f: extern "C" fn(*mut i32) = transmute(foo as extern "C" fn(_));
let f: extern "C" fn(*mut i32) = transmute(foo as usize); // works too
```
The same applies to transmutes to `*mut fn()`, which were observed in practice.
Note though that use of this type is generally incorrect.