Commit 78c03e3
# Objective
As noted in bevyengine#21856, the `Debug` output of `DebugName` is too verbose. It
is supposed to be a thin wrapper around a string, but it renders as a
`struct`.
## Solution
Manually `impl Debug for DebugName` and write the string directly.
## Showcase
The following code
```rust
#[derive(Debug)]
struct TestStruct {
debug_name: DebugName,
}
let test_struct = TestStruct {
debug_name: DebugName::type_name::<TestStruct>(),
};
println!("{test_struct:#?}");
```
Prints the following before this change
```
TestStruct {
debug_name: DebugName {
name: "crate_name::TestStruct",
},
}
```
And the following after it
```
TestStruct {
debug_name: "crate_name::TestStruct",
}
```
When the `debug` feature is disabled, it prints the following both
before and after the change
```
TestStruct {
debug_name: DebugName,
}
```
---------
Co-authored-by: François Mockers <[email protected]>
1 parent e5c78c0 commit 78c03e3
1 file changed
+9
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| |||
0 commit comments