Skip to content

Commit

Permalink
Bumped MSRV to 1.80 in order to use str::split_at_checked
Browse files Browse the repository at this point in the history
  • Loading branch information
sammhicks committed Jul 25, 2024
1 parent 6a7102e commit a1b806b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

include:
# Test MSRV
- rust: 1.62.0 # keep in sync with manifest rust-version
- rust: 1.80 # keep in sync with manifest rust-version
TARGET: x86_64-unknown-linux-gnu

# Test nightly but don't fail
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ categories = ["no-std"]
description = "serde-json for no_std programs"
documentation = "https://docs.rs/serde-json-core"
edition = "2018"
rust-version = "1.62.0" # keep in sync with ci, src/lib.rs, and README
rust-version = "1.80" # keep in sync with ci, src/lib.rs, and README
keywords = ["serde", "json"]
license = "MIT OR Apache-2.0"
name = "serde-json-core"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This project is developed and maintained by the [rust-embedded-community].

## Minimum Supported Rust Version (MSRV)

This crate is guaranteed to compile on stable Rust 1.62.0 and up. It *might*
This crate is guaranteed to compile on stable Rust 1.80 and up. It *might*
compile with older versions but that may change in any new patch release.

## License
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
//!
//! # Minimum Supported Rust Version (MSRV)
//!
//! This crate is guaranteed to compile on stable Rust 1.62.0 and up. It *might* compile with older
//! This crate is guaranteed to compile on stable Rust 1.80 and up. It *might* compile with older
//! versions but that may change in any new patch release.
// #![deny(missing_docs)]
Expand Down
11 changes: 4 additions & 7 deletions src/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,10 @@ fn unescape_next_fragment(
Some('r') => '\r',
Some('t') => '\t',
Some('u') => {
fn split_first_slice(s: &str, len: usize) -> Option<(&str, &str)> {
Some((s.get(..len)?, s.get(len..)?))
}

let (escape_sequence, remaining_escaped_string_chars) =
split_first_slice(escaped_string_chars.as_str(), 4)
.ok_or(StringUnescapeError::InvalidEscapeSequence)?;
let (escape_sequence, remaining_escaped_string_chars) = escaped_string_chars
.as_str()
.split_at_checked(4)
.ok_or(StringUnescapeError::InvalidEscapeSequence)?;

escaped_string_chars = remaining_escaped_string_chars.chars();

Expand Down

0 comments on commit a1b806b

Please sign in to comment.