rust-bitcoin-unsafe-fast/src
Andrew Poelstra 95548afccf
Merge rust-bitcoin/rust-bitcoin#798: Audit conversion methods
5fbb211085 Use fn name to_ instead of as_ (Tobin Harding)
8ffa32315d Use fn name to_ instead of into_ (Tobin Harding)
6874ce91e2 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 5fbb211085
  Kixunil:
    ACK 5fbb211085

Tree-SHA512: f750b2d1a10bc1d4bb030d8528a582701cc3d615aa8a8ab391324dae639544bb3629a19b372784e1e274a8ddcc613c621c7aae21a3ea54fde356a6aa5e611ac0
2022-06-01 16:19:36 +00:00
..
blockdata Merge rust-bitcoin/rust-bitcoin#798: Audit conversion methods 2022-06-01 16:19:36 +00:00
consensus Merge rust-bitcoin/rust-bitcoin#1004: Clear Clippy warnings 2022-06-01 16:18:46 +00:00
network Merge rust-bitcoin/rust-bitcoin#798: Audit conversion methods 2022-06-01 16:19:36 +00:00
util Merge rust-bitcoin/rust-bitcoin#798: Audit conversion methods 2022-06-01 16:19:36 +00:00
hash_types.rs Enable edition 2018 2022-05-11 10:16:48 +10:00
internal_macros.rs Add `consensus_decode_from_finite_reader` optimization 2022-05-30 21:15:34 -07:00
lib.rs Enable edition 2018 2022-05-11 10:16:48 +10:00
policy.rs Flatten the policy module 2022-03-09 10:20:18 +11:00
serde_utils.rs Enable edition 2018 2022-05-11 10:16:48 +10:00
test_macros.rs Refactor whitespace 2022-03-14 13:51:50 +11:00