Skip to content

Commit 8e7c4e0

Browse files
committed
rust: update hex to 0.4.3
1 parent 04c7034 commit 8e7c4e0

File tree

11 files changed

+141
-86
lines changed

11 files changed

+141
-86
lines changed

src/rust/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/rust/bitbox02-rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ bitbox02 = {path = "../bitbox02"}
3030
util = {path = "../util"}
3131
binascii = { version = "0.1.4", default-features = false, features = ["encode"] }
3232
bitbox02-noise = {path = "../bitbox02-noise"}
33-
hex = { version = "0.4", default-features = false }
33+
hex = { version = "0.4", default-features = false, features = ["alloc"] }
3434
sha2 = { version = "0.9.2", default-features = false }
3535
sha3 = { version = "0.9.1", default-features = false, optional = true }
3636
zeroize = "1.5.5"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"files":{"Cargo.toml":"3b509da1763642f9bd85382ae9d83a5f4355cf201b0fab9de719aa635ea0ff70","LICENSE-APACHE":"c6596eb7be8581c18be736c846fb9173b69eccf6ef94c5135893ec56bd92ba08","LICENSE-MIT":"f7bdb3426d045cd50efd4953026e3eb5a83d0199f458a075602611b9344da5b9","README.md":"4bbf89813cd9d2a04707299f34e1c906ed9e8247b910043f38d47b18a0d0641b","benches/hex.rs":"f1301fdaaf5f31cdd16e6988673201c9ce5b7dc65ae7cb7c69559b7adabf38bc","src/error.rs":"7c8af5efa9135fa24fc37dfcd973112c0766ccc7a4826078edb045df9a8efd79","src/lib.rs":"734506f5d604c7d7575d2c6bc31c75a10f628c7b41daa6be11656bd6f7117191","src/serde.rs":"8fb25650a850ae258ff9178bb8818145101dd3df40aa2725fc11b81bdd5d4567","tests/serde.rs":"28dca8a567daf9861413d1b1b5c2da13472f1c1b9c69db02598674cdbd633be2","tests/version-number.rs":"73301b7bfe500eada5ede66f0dce89bd3e354af50a8e7a123b02931cd5eb8e16"},"package":"644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35"}
1+
{"files":{"Cargo.toml":"85a822957796d1aa30bd28d695fae3dc86ca8832d6879a8f71e323cc4a130174","LICENSE-APACHE":"c6596eb7be8581c18be736c846fb9173b69eccf6ef94c5135893ec56bd92ba08","LICENSE-MIT":"f7bdb3426d045cd50efd4953026e3eb5a83d0199f458a075602611b9344da5b9","README.md":"ec487a539f41489876f5f2143e6f2071754ad96b1ca74092bdeab8135f6a819e","benches/hex.rs":"17f5081cc970fc5a0e7bf7e781da066ece95c4453b46ad8c129e665b19733885","src/error.rs":"489873510e45802b3b1858668daf46eb559cf0d0cebb41ca34cf5879dabe730e","src/lib.rs":"bc16c851822629225d2d2653ea080f131b0f2c4704d3ff27fed955c9b8b42f71","src/serde.rs":"d1297456aa4e9e11eb45ac41fb7b9d7d88b7de371a118e4c100bd78fc208ea86","tests/serde.rs":"567b0b58d9d1fac12b4ebb7bff6164bdef01b7c9edc59435a2d7507214c6481b","tests/version-number.rs":"913773b7a6b62c6fbea14f155571eb77c2ae8b0ac811dde8e028dee25a4155be"},"package":"7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"}

src/rust/vendor/hex/Cargo.toml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
[package]
1414
edition = "2018"
1515
name = "hex"
16-
version = "0.4.2"
16+
version = "0.4.3"
1717
authors = ["KokaKiwi <[email protected]>"]
1818
description = "Encoding and decoding data into/from hexadecimal representation."
1919
documentation = "https://docs.rs/hex/"
@@ -32,17 +32,18 @@ harness = false
3232
[dependencies.serde]
3333
version = "1.0"
3434
optional = true
35+
default-features = false
3536
[dev-dependencies.criterion]
3637
version = "0.3"
3738

3839
[dev-dependencies.faster-hex]
39-
version = "0.4"
40+
version = "0.5"
4041

4142
[dev-dependencies.pretty_assertions]
4243
version = "0.6"
4344

4445
[dev-dependencies.rustc-hex]
45-
version = "2.0"
46+
version = "2.1"
4647

4748
[dev-dependencies.serde]
4849
version = "1.0"
@@ -52,11 +53,11 @@ features = ["derive"]
5253
version = "1.0"
5354

5455
[dev-dependencies.version-sync]
55-
version = "0.8"
56+
version = "0.9"
5657

5758
[features]
59+
alloc = []
5860
default = ["std"]
59-
std = []
60-
[badges.travis-ci]
61-
branch = "master"
62-
repository = "KokaKiwi/rust-hex"
61+
std = ["alloc"]
62+
[badges.maintenance]
63+
status = "actively-developed"

src/rust/vendor/hex/README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
hex
2-
===
1+
# hex
2+
33
[![Crates.io: hex](https://img.shields.io/crates/v/hex.svg)](https://crates.io/crates/hex)
44
[![Documentation](https://docs.rs/hex/badge.svg)](https://docs.rs/hex)
5-
[![Build Status (Travis)](https://travis-ci.org/KokaKiwi/rust-hex.svg?branch=master)](https://travis-ci.org/KokaKiwi/rust-hex)
65
[![Build Status (Github Actions)](https://github.com/KokaKiwi/rust-hex/workflows/Test%20hex/badge.svg?master)](https://github.com/KokaKiwi/rust-hex/actions)
76

87
Encoding and decoding data into/from hexadecimal representation.
98

109
## Examples
1110

1211
Encoding a `String`
12+
1313
```rust
1414
let hex_string = hex::encode("Hello world!");
1515

1616
println!("{}", hex_string); // Prints "48656c6c6f20776f726c6421"
1717
```
1818

1919
Decoding a `String`
20+
2021
```rust
2122
let decoded_string = hex::decode("48656c6c6f20776f726c6421");
2223

@@ -28,6 +29,7 @@ You can find the [documentation](https://docs.rs/hex) here.
2829
## Installation
2930

3031
In order to use this crate, you have to add it under `[dependencies]` to your `Cargo.toml`
32+
3133
```toml
3234
[dependencies]
3335
hex = "0.4"
@@ -45,17 +47,17 @@ hex = { version = "0.4", default-features = false }
4547
## Features
4648

4749
- `std`:
48-
Enabled by default. Add support for Rust's libstd types.
50+
Enabled by default. Add support for Rust's libstd types.
4951
- `serde`:
50-
Disabled by default. Add support for `serde` de/serializing library.
51-
See the `serde` module documentation for usage.
52+
Disabled by default. Add support for `serde` de/serializing library.
53+
See the `serde` module documentation for usage.
5254

5355
## License
5456

5557
Licensed under either of
5658

57-
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
58-
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
59+
- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
60+
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
5961

6062
at your option.
6163

src/rust/vendor/hex/benches/hex.rs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,34 +35,25 @@ fn bench_decode(c: &mut Criterion) {
3535
c.bench_function("faster_hex_decode", move |b| {
3636
let hex = faster_hex::hex_string(DATA).unwrap();
3737
let len = DATA.len();
38-
b.iter(|| {
39-
let mut dst = Vec::with_capacity(len);
40-
dst.resize(len, 0);
41-
faster_hex::hex_decode(hex.as_bytes(), &mut dst).unwrap();
42-
dst
43-
})
38+
let mut dst = vec![0; len];
39+
40+
b.iter(|| faster_hex::hex_decode(hex.as_bytes(), &mut dst).unwrap())
4441
});
4542

4643
c.bench_function("faster_hex_decode_unchecked", |b| {
4744
let hex = faster_hex::hex_string(DATA).unwrap();
4845
let len = DATA.len();
49-
b.iter(|| {
50-
let mut dst = Vec::with_capacity(len);
51-
dst.resize(len, 0);
52-
faster_hex::hex_decode_unchecked(hex.as_bytes(), &mut dst);
53-
dst
54-
})
46+
let mut dst = vec![0; len];
47+
48+
b.iter(|| faster_hex::hex_decode_unchecked(hex.as_bytes(), &mut dst))
5549
});
5650

5751
c.bench_function("faster_hex_decode_fallback", |b| {
5852
let hex = faster_hex::hex_string(DATA).unwrap();
5953
let len = DATA.len();
60-
b.iter(|| {
61-
let mut dst = Vec::with_capacity(len);
62-
dst.resize(len, 0);
63-
faster_hex::hex_decode_fallback(hex.as_bytes(), &mut dst);
64-
dst
65-
})
54+
let mut dst = vec![0; len];
55+
56+
b.iter(|| faster_hex::hex_decode_fallback(hex.as_bytes(), &mut dst))
6657
});
6758
}
6859

src/rust/vendor/hex/src/error.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,17 @@ impl fmt::Display for FromHexError {
3333
}
3434

3535
#[cfg(test)]
36+
// this feature flag is here to suppress unused
37+
// warnings of `super::*` and `pretty_assertions::assert_eq`
38+
#[cfg(feature = "alloc")]
3639
mod tests {
3740
use super::*;
38-
#[cfg(not(feature = "std"))]
41+
#[cfg(feature = "alloc")]
3942
use alloc::string::ToString;
4043
use pretty_assertions::assert_eq;
4144

4245
#[test]
46+
#[cfg(feature = "alloc")]
4347
fn test_display() {
4448
assert_eq!(
4549
FromHexError::InvalidHexCharacter { c: '\n', index: 5 }.to_string(),

0 commit comments

Comments
 (0)