Skip to content

Commit

Permalink
Merge #33: Fix CI
Browse files Browse the repository at this point in the history
cce5574 Remove unnecessary use of vec macro (Tobin C. Harding)
a640e7f ci: Pin memchr for MSRV build (Tobin C. Harding)

Pull request description:

  Fix CI by doing:

  - Pin `memchr`
  - Fix new clippy version warnings (remove unnecessary `vec`)

ACKs for top commit:
  apoelstra:
    ACK cce5574

Tree-SHA512: 962b72b7cb2e89e4448ad5db0652020b750d32de112f13307be2f98e1eb1f492c92dc443e7827cc20912abb87f25e49509ff125c2a1b916ba2905194efa39a28
  • Loading branch information
apoelstra committed Oct 25, 2023
2 parents ea40b56 + cce5574 commit d61f5f9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
6 changes: 6 additions & 0 deletions contrib/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -ex

FEATURES="std alloc core2"
MSRV="1\.48\.0"

cargo --version
rustc --version
Expand All @@ -13,6 +14,11 @@ if cargo --version | grep nightly >/dev/null; then
NIGHTLY=true
fi

if cargo --version | grep ${MSRV}; then
# memchr 2.6.0 uses edition 2021
cargo update -p memchr --precise 2.5.0
fi

# Make all cargo invocations verbose
export CARGO_TERM_VERBOSE=true

Expand Down
16 changes: 8 additions & 8 deletions src/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,39 +207,39 @@ mod tests {
#[test]
fn decode_iter_forward() {
let hex = "deadbeef";
let v = vec![0xde, 0xad, 0xbe, 0xef];
let bytes = [0xde, 0xad, 0xbe, 0xef];

for (i, b) in HexToBytesIter::new(hex).unwrap().enumerate() {
assert_eq!(b.unwrap(), v[i]);
assert_eq!(b.unwrap(), bytes[i]);
}
}

#[test]
fn decode_iter_backward() {
let hex = "deadbeef";
let v = vec![0xef, 0xbe, 0xad, 0xde];
let bytes = [0xef, 0xbe, 0xad, 0xde];

for (i, b) in HexToBytesIter::new(hex).unwrap().rev().enumerate() {
assert_eq!(b.unwrap(), v[i]);
assert_eq!(b.unwrap(), bytes[i]);
}
}

#[test]
fn encode_iter() {
let v = vec![0xde, 0xad, 0xbe, 0xef];
let bytes = [0xde, 0xad, 0xbe, 0xef];
let hex = "deadbeef";

for (i, c) in BytesToHexIter::new(v.iter().cloned()).enumerate() {
for (i, c) in BytesToHexIter::new(bytes.iter().cloned()).enumerate() {
assert_eq!(c, hex.chars().nth(i).unwrap());
}
}

#[test]
fn encode_iter_backwards() {
let v = vec![0xde, 0xad, 0xbe, 0xef];
let bytes = [0xde, 0xad, 0xbe, 0xef];
let hex = "efbeadde";

for (i, c) in BytesToHexIter::new(v.iter().cloned()).rev().enumerate() {
for (i, c) in BytesToHexIter::new(bytes.iter().cloned()).rev().enumerate() {
assert_eq!(c, hex.chars().nth(i).unwrap());
}
}
Expand Down

0 comments on commit d61f5f9

Please sign in to comment.