Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #798: Audit conversion methods
5fbb211 Use fn name to_ instead of as_ (Tobin Harding) 8ffa323 Use fn name to_ instead of into_ (Tobin Harding) 6874ce9 Remove as_inner (Tobin C. Harding) Pull request description: Rust has naming conventions surrounding conversion functions We have a handful of methods that are not following convention. This PR is done as three patches, separated by incorrect function name (`into_` or `as_`) and by whether or not the original method needs deprecating. Can be squashed if folks prefer. From the docs: https://rust-lang.github.io/api-guidelines/naming.html <h2><a class="header" href="https://rust-lang.github.io/api-guidelines/naming.html#ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv" id="ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv">Ad-hoc conversions follow <code>as_</code>, <code>to_</code>, <code>into_</code> conventions (C-CONV)</a></h2> <p>Conversions should be provided as methods, with names prefixed as follows:</p> Prefix | Cost | Ownership -- | -- | -- as_ | Free | borrowed -> borrowed to_ | Expensive | borrowed -> borrowed | | | borrowed -> owned (non-Copy types) | | | owned -> owned (Copy types) into_ | Variable | owned -> owned (non-Copy types) EDIT: I did actually audit all uses of `to_` when I first did this, I did this by grepping for `fn to_` and checking the output against the table. ACKs for top commit: apoelstra: ACK 5fbb211 Kixunil: ACK 5fbb211 Tree-SHA512: f750b2d1a10bc1d4bb030d8528a582701cc3d615aa8a8ab391324dae639544bb3629a19b372784e1e274a8ddcc613c621c7aae21a3ea54fde356a6aa5e611ac0
- Loading branch information
Showing
7 changed files
with
122 additions
and
54 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
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.