Raise MSRV to 1.80

This commit is contained in:
René Kijewski 2024-11-13 23:33:06 +01:00
parent 9b733d8887
commit d3b9b6ea56
12 changed files with 15 additions and 41 deletions

View File

@ -97,7 +97,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.71.1"
toolchain: "1.80.0"
- run: cargo check --lib -p rinja --all-features
Audit:

View File

@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0"
workspace = ".."
readme = "../README.md"
edition = "2021"
rust-version = "1.71"
rust-version = "1.80"
[package.metadata.docs.rs]
features = ["full"]

View File

@ -13,7 +13,7 @@ repository = "https://github.com/rinja-rs/rinja"
license = "MIT OR Apache-2.0"
readme = "README.md"
edition = "2021"
rust-version = "1.71"
rust-version = "1.80"
[package.metadata.docs.rs]
all-features = true

View File

@ -5,7 +5,7 @@ members = ["."]
name = "rinja_axum"
version = "0.3.5"
edition = "2021"
rust-version = "1.71"
rust-version = "1.80"
description = "Axum integration for Rinja templates"
keywords = ["markup", "template", "jinja2", "html", "axum"]
categories = ["template-engine"]

View File

@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
workspace = ".."
readme = "README.md"
edition = "2021"
rust-version = "1.71"
rust-version = "1.80"
[package.metadata.docs.rs]
all-features = true

View File

@ -10,7 +10,7 @@ repository = "https://github.com/rinja-rs/rinja"
license = "MIT OR Apache-2.0"
readme = "README.md"
edition = "2021"
rust-version = "1.71"
rust-version = "1.80"
publish = false
[package.metadata.docs.rs]

View File

@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0"
workspace = ".."
readme = "README.md"
edition = "2021"
rust-version = "1.71"
rust-version = "1.80"
[package.metadata.docs.rs]
all-features = true

View File

@ -274,40 +274,14 @@ impl<'a> From<ErrorContext<'a>> for winnow::error::ErrMode<ErrorContext<'a>> {
}
}
/// FIXME: replace with `s.trim_ascii_start()` when we raise our MSRV to 1.80
fn trim_ascii_start(s: &str) -> &str {
let mut s = s.as_bytes();
loop {
match s {
[c, tail @ ..] if c.is_ascii_whitespace() => s = tail,
// SAFETY: either we are at the front of the input, at an empty input, or the previous
// character was an ASCII character, so we must be at a char boundary
s => return unsafe { std::str::from_utf8_unchecked(s) },
}
}
}
/// FIXME: replace with `s.trim_ascii_end()` when we raise our MSRV to 1.80
fn trim_ascii_end(s: &str) -> &str {
let mut s = s.as_bytes();
loop {
match s {
[init @ .., c] if c.is_ascii_whitespace() => s = init,
// SAFETY: either we are at the front of the input, at an empty input, or the previous
// character was an ASCII character, so we must be at a char boundary
s => return unsafe { std::str::from_utf8_unchecked(s) },
}
}
}
#[inline]
fn skip_ws0(i: &str) -> ParseResult<'_, ()> {
Ok((trim_ascii_start(i), ()))
Ok((i.trim_ascii_start(), ()))
}
#[inline]
fn skip_ws1(i: &str) -> ParseResult<'_, ()> {
let j = trim_ascii_start(i);
let j = i.trim_ascii_start();
if i.len() != j.len() {
Ok((j, ()))
} else {

View File

@ -10,7 +10,7 @@ use winnow::token::{any, tag};
use crate::memchr_splitter::{Splitter1, Splitter2, Splitter3};
use crate::{
ErrorContext, Expr, Filter, ParseResult, State, Target, WithSpan, filter, identifier, keyword,
skip_till, skip_ws0, str_lit_without_prefix, trim_ascii_end, trim_ascii_start, ws,
skip_till, skip_ws0, str_lit_without_prefix, ws,
};
#[derive(Debug, PartialEq)]
@ -1073,9 +1073,9 @@ impl<'a> Lit<'a> {
}
pub(crate) fn split_ws_parts(s: &'a str) -> Self {
let trimmed_start = trim_ascii_start(s);
let trimmed_start = s.trim_ascii_start();
let len_start = s.len() - trimmed_start.len();
let trimmed = trim_ascii_end(trimmed_start);
let trimmed = trimmed_start.trim_ascii_end();
Self {
lws: &s[..len_start],
val: trimmed,

View File

@ -13,7 +13,7 @@ repository = "https://github.com/rinja-rs/rinja"
license = "MIT OR Apache-2.0"
readme = "README.md"
edition = "2021"
rust-version = "1.71"
rust-version = "1.80"
[package.metadata.docs.rs]
all-features = true

View File

@ -13,7 +13,7 @@ repository = "https://github.com/rinja-rs/rinja"
license = "MIT OR Apache-2.0"
readme = "README.md"
edition = "2021"
rust-version = "1.71"
rust-version = "1.80"
[package.metadata.docs.rs]
all-features = true

View File

@ -4,7 +4,7 @@ version = "0.3.5"
authors = ["rinja-rs developers"]
workspace = ".."
edition = "2021"
rust-version = "1.71"
rust-version = "1.80"
publish = false
[features]