Skip to content

Commit

Permalink
Use Rust 1.65.0 as minimal Rust version
Browse files Browse the repository at this point in the history
  • Loading branch information
bluk committed May 2, 2023
1 parent f544751 commit 1bd673d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- windows-latest
rust:
- stable
- 1.65.0
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
Expand Down Expand Up @@ -58,6 +59,7 @@ jobs:
- windows-latest
rust:
- stable
- 1.65.0
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ include = [
"LICENSE-APACHE",
"LICENSE-MIT",
]
rust-version = "1.65"

[dependencies]
base64ct = { version = "1.5", default-features = false, features = ["alloc"] }
Expand Down
11 changes: 5 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +310,14 @@ impl<'a> UnverifiedJwt<'a> {

fn split(jwt: &str) -> Result<SplitJwt<'_>> {
let mut parts = jwt.rsplitn(2, '.');
let (signature, signed_data) = match (parts.next(), parts.next()) {
(Some(signature), Some(signed_data)) => (signature, signed_data),
_ => return Err(Error::malformed_jwt()),

let (Some(signature), Some(signed_data)) = (parts.next(), parts.next()) else {
return Err(Error::malformed_jwt());
};

let mut parts = signed_data.rsplitn(3, '.');
let (claims, header) = match (parts.next(), parts.next(), parts.next()) {
(Some(claims), Some(header), None) => (claims, header),
_ => return Err(Error::malformed_jwt()),
let (Some(claims), Some(header), None) = (parts.next(), parts.next(), parts.next()) else {
return Err(Error::malformed_jwt());
};

Ok(SplitJwt {
Expand Down

0 comments on commit 1bd673d

Please sign in to comment.