From b28bd9bca4dc81d75d86346d8d5ac73a6cfbfb9a Mon Sep 17 00:00:00 2001 From: Julien Cretin Date: Sat, 2 Mar 2024 14:25:34 +0100 Subject: [PATCH] Fix build with new nightly (#98) --- .github/workflows/ci.yml | 4 ++-- cmp/tests/lib.rs | 15 ++++++++------- lib/fuzz/examples/analyze.rs | 4 +--- lib/src/lib.rs | 3 ++- www/Makefile | 2 +- xtask/src/main.rs | 7 +++---- 6 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d02a20b..9f153e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: ubuntu: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup install nightly - run: rustup component add --toolchain=nightly clippy miri rustfmt - name: cd lib && cargo +nightly fmt -- --check @@ -257,7 +257,7 @@ jobs: windows: runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: rustup install nightly - name: cd lib && cargo +nightly build run: cargo +nightly build diff --git a/cmp/tests/lib.rs b/cmp/tests/lib.rs index 471f15f..2d103a4 100644 --- a/cmp/tests/lib.rs +++ b/cmp/tests/lib.rs @@ -1,3 +1,4 @@ +use base64::prelude::{Engine, BASE64_STANDARD}; use base64::DecodeError::*; use data_encoding::DecodeKind::*; use data_encoding::{DecodeError, BASE64}; @@ -30,23 +31,23 @@ fn encode_exact() { fn difference() { let x = b"AAB="; assert_eq!(BASE64.decode(x).err().unwrap(), DecodeError { position: 2, kind: Trailing }); - assert_eq!(base64::decode(x).err().unwrap(), InvalidLastSymbol(2, b'B')); + assert_eq!(BASE64_STANDARD.decode(x).err().unwrap(), InvalidLastSymbol(2, b'B')); let x = b"AA\nB="; assert_eq!(BASE64.decode(x).err().unwrap(), DecodeError { position: 4, kind: Length }); - assert_eq!(base64::decode(x).err().unwrap(), InvalidLength); + assert_eq!(BASE64_STANDARD.decode(x).err().unwrap(), InvalidByte(2, b'\n')); let x = b"AAB"; assert_eq!(BASE64.decode(x).err().unwrap(), DecodeError { position: 0, kind: Length }); - assert_eq!(base64::decode(x).err().unwrap(), InvalidPadding); + assert_eq!(BASE64_STANDARD.decode(x).err().unwrap(), InvalidPadding); let x = b"AAA"; assert_eq!(BASE64.decode(x).err().unwrap(), DecodeError { position: 0, kind: Length }); - assert_eq!(base64::decode(x).err().unwrap(), InvalidPadding); + assert_eq!(BASE64_STANDARD.decode(x).err().unwrap(), InvalidPadding); let x = b"A\rA\nB="; assert_eq!(BASE64.decode(x).err().unwrap(), DecodeError { position: 4, kind: Length }); - assert_eq!(base64::decode(x).err().unwrap(), InvalidByte(1, b'\r')); + assert_eq!(BASE64_STANDARD.decode(x).err().unwrap(), InvalidByte(1, b'\r')); let x = b"-_\r\n"; assert_eq!(BASE64.decode(x).err().unwrap(), DecodeError { position: 0, kind: Symbol }); - assert_eq!(base64::decode(x).err().unwrap(), InvalidByte(0, b'-')); + assert_eq!(BASE64_STANDARD.decode(x).err().unwrap(), InvalidByte(0, b'-')); let x = b"AA==AA=="; assert_eq!(BASE64.decode(x).unwrap(), vec![0, 0]); - assert_eq!(base64::decode(x).err().unwrap(), InvalidByte(2, b'=')); + assert_eq!(BASE64_STANDARD.decode(x).err().unwrap(), InvalidByte(2, b'=')); } diff --git a/lib/fuzz/examples/analyze.rs b/lib/fuzz/examples/analyze.rs index bc4a1fd..6e834c2 100644 --- a/lib/fuzz/examples/analyze.rs +++ b/lib/fuzz/examples/analyze.rs @@ -1,5 +1,3 @@ -#![feature(core_intrinsics)] - extern crate data_encoding; extern crate data_encoding_fuzz; @@ -77,7 +75,7 @@ impl Stat { let encoding = generate_specification(&mut data).encoding().unwrap(); let spec = encoding.specification(); let mut stat = HashMap::new(); - assert!(stat.insert(Key::Bit, std::intrinsics::cttz(spec.symbols.len())).is_none()); + assert!(stat.insert(Key::Bit, spec.symbols.len().trailing_zeros() as usize).is_none()); assert!(stat .insert(Key::Msb, (spec.bit_order == BitOrder::MostSignificantFirst) as usize) .is_none()); diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 301ade9..ff65d0d 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -97,7 +97,7 @@ //! | Input | `data-encoding` | `base64` | GNU `base64` | //! | ---------- | --------------- | --------- | ------------- | //! | `AAB=` | `Trailing(2)` | `Last(2)` | `\x00\x00` | -//! | `AA\nB=` | `Length(4)` | `Length` | `\x00\x00` | +//! | `AA\nB=` | `Length(4)` | `Byte(2)` | `\x00\x00` | //! | `AAB` | `Length(0)` | `Padding` | Invalid input | //! | `AAA` | `Length(0)` | `Padding` | Invalid input | //! | `A\rA\nB=` | `Length(4)` | `Byte(1)` | Invalid input | @@ -155,6 +155,7 @@ #![warn(unused_results)] #![allow(unused_unsafe)] // TODO(msrv) #![warn(clippy::pedantic)] +#![allow(clippy::doc_markdown)] #![allow(clippy::enum_glob_use)] #![allow(clippy::similar_names)] #![allow(clippy::uninlined_format_args)] // TODO(msrv) diff --git a/www/Makefile b/www/Makefile index a8d2b6c..b827b5c 100644 --- a/www/Makefile +++ b/www/Makefile @@ -12,7 +12,7 @@ html: cargo build --target wasm32-unknown-unknown --release rsync -a --delete static/ html wasm-bindgen --no-typescript --no-modules \ - target/wasm32-unknown-unknown/release/data_encoding_www.wasm \ + ../target/wasm32-unknown-unknown/release/data_encoding_www.wasm \ --out-dir html .PHONY: clean diff --git a/xtask/src/main.rs b/xtask/src/main.rs index cfd6fb5..c1b64ec 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -1,4 +1,3 @@ -#![feature(slice_group_by)] #![feature(iter_intersperse)] use std::borrow::Cow; @@ -380,14 +379,14 @@ impl Flags { }, jobs: BTreeMap::new(), }; - for actions in actions.group_by(|x, y| x.os == y.os) { + for actions in actions.chunk_by(|x, y| x.os == y.os) { let mut job = WorkflowJob { runs_on: format!("{}-latest", actions[0].os), steps: vec![] }; job.steps.push(WorkflowStep { - uses: Some("actions/checkout@v3".to_owned()), + uses: Some("actions/checkout@v4".to_owned()), ..Default::default() }); - for actions in actions.group_by(|x, y| x.toolchain == y.toolchain) { + for actions in actions.chunk_by(|x, y| x.toolchain == y.toolchain) { job.steps.push(WorkflowStep { run: Some(format!("rustup install {}", actions[0].toolchain)), ..Default::default()