diff --git a/STYLE.md b/STYLE.md index 7d97e7334..0c4c17f98 100644 --- a/STYLE.md +++ b/STYLE.md @@ -161,3 +161,16 @@ are documented. Follow Rust guidelines for the documentation comments: + +## Do not use `into()`, `try_into()` or `parse()` + +For internal types, implementing `From`, `TryFrom` or `FromStr` is discouraged. +Instead, a `new()` function is recommended. + +For external types, use `Type::from()`, `Type::try_from()` or `Type::from_str()` directly +rather than `into()`, `try_into()` or `parse()`. + +Calling `into()`, `try_into()` or `parse()` +creates an indirection, +which is hard to follow for people who are not familiar with Rust, +or who are not using rust-analyzer.