-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Impl Display rather than ToString (#663)
Updated the 3 places where ToString impls were generated (in `type_entry.rs`) and replaced them with an equivalent Display impl. ToString is implemented for all types that implement Display and for this reason the docs recommend not to implement ToString directly [0] and is actually linted against by clippy in the default groups [1]. The snapshots were updated by running `EXPECTORATE=overwrite cargo test --workspace` and then afterwards I did a brief manual verification that the generated results seemed sensible. Updated the README for `cargo-typify` to switch out the ToString impl for the Display version. Since the output in the README is a simplified version of the real output (the real output has a lot more fields and noise), I manually added the Display impl in the style of the rest of the example (nb. the Display impl does correctly appear in the real output). 0: https://doc.rust-lang.org/std/string/trait.ToString.html 1: https://rust-lang.github.io/rust-clippy/master/index.html#/to_string_trait_impl
- Loading branch information
1 parent
261e1e0
commit 0ef2496
Showing
15 changed files
with
3,872 additions
and
3,866 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.