mirror of
https://github.com/chatmail/core.git
synced 2026-04-28 10:56:29 +03:00
docs: Discourage into(), try_into() and parse()
This commit is contained in:
13
STYLE.md
13
STYLE.md
@@ -161,3 +161,16 @@ are documented.
|
||||
|
||||
Follow Rust guidelines for the documentation comments:
|
||||
<https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#summary-sentence>
|
||||
|
||||
## 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.
|
||||
|
||||
Reference in New Issue
Block a user