Skip to content

lint: use as_chunks instead of chunks_exact - #451

Merged
djc merged 1 commit into
rustls:mainfrom
jgreeer:fix-clippy-chunks-exact-to-as-chunks
Sep 9, 2026
Merged

lint: use as_chunks instead of chunks_exact#451
djc merged 1 commit into
rustls:mainfrom
jgreeer:fix-clippy-chunks-exact-to-as-chunks

Conversation

@jgreeer

@jgreeer jgreeer commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

From a rust-clippy 1.98 CI run:

error: using `chunks_exact` with a constant chunk size
   --> rcgen/src/string.rs:430:8
    |
430 |             vec.chunks_exact(2)
    |                 ^^^^^^^^^^^^^^^ help: consider using `as_chunks` instead: `as_chunks::<2>().0.iter()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#chunks_exact_to_as_chunks
    = note: `-D clippy::chunks-exact-to-as-chunks` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::chunks_exact_to_as_chunks)]`

error: using `chunks_exact` with a constant chunk size
   --> rcgen/src/string.rs:549:5
    |
549 |             .chunks_exact(4)
    |              ^^^^^^^^^^^^^^^ help: consider using `as_chunks` instead: `as_chunks::<4>().0.iter()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#chunks_exact_to_as_chunks

    Checking regex-syntax v0.8.10
error: could not compile `rcgen` (lib) due to 2 previous errors

as_chunks stablized in rust 1.88.0, which is this crate's MSRV.

@djc djc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@djc
djc enabled auto-merge September 9, 2026 15:08
@djc
djc added this pull request to the merge queue Sep 9, 2026
Merged via the queue into rustls:main with commit e790da1 Sep 9, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants