Rust's `.into()` is a strictly bad thing
Rust’s .into()
is a strictly bad thing
It just makes the code unreadable for no gain.
Instead of defining methods with readable and meaningful names for transforming objects into other objects and calling those, the .into()
bad practice just teaches everybody to write .into()
everywhere, making the code impossible to read without a superpowered editor – and sometimes even with it.
Published at
2024-01-14 14:55:28Event JSON
{
"id": "689add464a1842cd8cb1d850d2b8d31850b02d068c578476a4552dfef0d9fcb0",
"pubkey": "3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d",
"created_at": 1705240528,
"kind": 30023,
"tags": [
[
"d",
"1661a170"
],
[
"title",
"Rust's `.into()` is a strictly bad thing"
],
[
"published_at",
"1693427580"
]
],
"content": "\n# Rust's `.into()` is a strictly bad thing\n\nIt just makes the code unreadable for no gain.\n\nInstead of defining methods with readable and meaningful names for transforming objects into other objects and calling those, the `.into()` bad practice just teaches everybody to write `.into()` everywhere, making the code impossible to read without a superpowered editor -- and sometimes [even with it](https://github.com/rust-lang/rust-analyzer/issues/15315).\n",
"sig": "edf714171f412847f14c1ca6d7aec4ad4a70c40b8242c895c3e3a8eb5beb47d3265e312bc32880162706b84b42919d7e2b912fbceb4a074c69fd5b5a746a4100"
}