Skip to content

Commit e40f464

Browse files
authored
test: add msrv verify as ci check (#480)
The MSRV got unknowingly bumped before, with this CI check we will avoid it in the future.
1 parent b91418d commit e40f464

File tree

4 files changed

+56
-35
lines changed

4 files changed

+56
-35
lines changed

.github/workflows/rust.yml

+25
Original file line numberDiff line numberDiff line change
@@ -346,3 +346,28 @@ jobs:
346346

347347
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
348348
- uses: EmbarkStudios/cargo-deny-action@68cd9c5e3e16328a430a37c743167572e3243e7e # v1.5.15
349+
350+
cargo-msrv:
351+
name: Verify MSRV (cargo-msrv)
352+
runs-on: ubuntu-latest
353+
steps:
354+
- name: Harden Runner
355+
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
356+
with:
357+
egress-policy: audit
358+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
359+
with:
360+
submodules: true
361+
- name: cargo install cargo-msrv
362+
# You may pin to the exact commit or the version.
363+
# uses: baptiste0928/cargo-install@1cd874a5478fdca35d868ccc74640c5aabbb8f1b
364+
uses: baptiste0928/[email protected]
365+
with:
366+
# Name of the crate to install
367+
crate: cargo-msrv
368+
- name: Run cargo-msrv verify on rsonpath
369+
run: cargo msrv --path ./crates/rsonpath verify
370+
- name: Run cargo-msrv verify on rsonpath-lib
371+
run: cargo msrv --path ./crates/rsonpath-lib verify
372+
- name: Run cargo-msrv verify on rsonpath-syntax
373+
run: cargo msrv --path ./crates/rsonpath-syntax verify

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
[![GitHub Release Date](https://img.shields.io/github/release-date/v0ldek/rsonpath?logo=github)](https://github.com/V0ldek/rsonpath/releases)
1313
[![GitHub last commit](https://img.shields.io/github/last-commit/v0ldek/rsonpath?logo=github)](https://github.com/V0ldek/rsonpath/commits/main)
1414

15-
![MSRV](https://img.shields.io/badge/msrv-v1.70.0-orange?logo=rust "Minimum Supported Rust Version for `rq`")
15+
![MSRV](https://img.shields.io/badge/msrv-v1.67.1-orange?logo=rust "Minimum Supported Rust Version for `rsonpath-lib`")
1616
[![License](https://img.shields.io/crates/l/rsonpath)](https://choosealicense.com/licenses/mit/)
1717

1818
Experimental JSONPath engine for querying massive streamed datasets.

crates/rsonpath-syntax/src/error.rs

+29-33
Original file line numberDiff line numberDiff line change
@@ -702,18 +702,6 @@ impl SyntaxErrorKind {
702702
}
703703
}
704704

705-
pub(super) trait ErrorStyle {
706-
fn empty() -> Self;
707-
fn error_prefix<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a;
708-
fn error_message<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a;
709-
fn error_position_hint<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a;
710-
fn error_underline<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a;
711-
fn error_underline_message<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a;
712-
fn line_numbers<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a;
713-
fn note_prefix<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a;
714-
fn suggestion<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a;
715-
}
716-
717705
#[cfg(feature = "color")]
718706
mod colored {
719707
use super::{fmt_parse_error, ParseError};
@@ -761,10 +749,8 @@ mod colored {
761749
suggestion: suggestion_color,
762750
}
763751
}
764-
}
765752

766-
impl super::ErrorStyle for OwoColorsErrorStyle {
767-
fn empty() -> Self {
753+
pub(crate) fn empty() -> Self {
768754
let empty_style = owo_colors::Style::new();
769755
Self {
770756
error_prefix: empty_style,
@@ -778,42 +764,42 @@ mod colored {
778764
}
779765
}
780766

781-
fn error_prefix<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
767+
pub(crate) fn error_prefix<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
782768
use owo_colors::OwoColorize;
783769
target.style(self.error_prefix)
784770
}
785771

786-
fn error_message<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
772+
pub(crate) fn error_message<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
787773
use owo_colors::OwoColorize;
788774
target.style(self.error_message)
789775
}
790776

791-
fn error_position_hint<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
777+
pub(crate) fn error_position_hint<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
792778
use owo_colors::OwoColorize;
793779
target.style(self.error_position_hint)
794780
}
795781

796-
fn error_underline<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
782+
pub(crate) fn error_underline<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
797783
use owo_colors::OwoColorize;
798784
target.style(self.error_underline)
799785
}
800786

801-
fn error_underline_message<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
787+
pub(crate) fn error_underline_message<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
802788
use owo_colors::OwoColorize;
803789
target.style(self.error_underline_message)
804790
}
805791

806-
fn line_numbers<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
792+
pub(crate) fn line_numbers<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
807793
use owo_colors::OwoColorize;
808794
target.style(self.line_numbers)
809795
}
810796

811-
fn note_prefix<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
797+
pub(crate) fn note_prefix<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
812798
use owo_colors::OwoColorize;
813799
target.style(self.note_prefix)
814800
}
815801

816-
fn suggestion<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
802+
pub(crate) fn suggestion<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
817803
use owo_colors::OwoColorize;
818804
target.style(self.suggestion)
819805
}
@@ -827,40 +813,50 @@ mod plain {
827813
#[derive(Clone)]
828814
pub(super) struct PlainErrorStyle;
829815

830-
impl super::ErrorStyle for PlainErrorStyle {
831-
fn empty() -> Self {
816+
impl PlainErrorStyle {
817+
pub(crate) fn empty() -> Self {
832818
Self
833819
}
834820

835-
fn error_prefix<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
821+
// We want to keep the same function signature as for the colored version, so `&self` must be here.
822+
// We could use a trait, but returning `impl trait` in traits would bump MSRV to 1.75.
823+
#[allow(clippy::unused_self)]
824+
pub(crate) fn error_prefix<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
836825
target
837826
}
838827

839-
fn error_message<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
828+
#[allow(clippy::unused_self)]
829+
pub(crate) fn error_message<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
840830
target
841831
}
842832

843-
fn error_position_hint<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
833+
#[allow(clippy::unused_self)]
834+
pub(crate) fn error_position_hint<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
844835
target
845836
}
846837

847-
fn error_underline<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
838+
#[allow(clippy::unused_self)]
839+
pub(crate) fn error_underline<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
848840
target
849841
}
850842

851-
fn error_underline_message<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
843+
#[allow(clippy::unused_self)]
844+
pub(crate) fn error_underline_message<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
852845
target
853846
}
854847

855-
fn line_numbers<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
848+
#[allow(clippy::unused_self)]
849+
pub(crate) fn line_numbers<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
856850
target
857851
}
858852

859-
fn note_prefix<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
853+
#[allow(clippy::unused_self)]
854+
pub(crate) fn note_prefix<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
860855
target
861856
}
862857

863-
fn suggestion<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
858+
#[allow(clippy::unused_self)]
859+
pub(crate) fn suggestion<'a, D: Display>(&self, target: &'a D) -> impl Display + 'a {
864860
target
865861
}
866862
}

crates/rsonpath/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ homepage = "https://v0ldek.github.io/rsonpath/"
1616
build = "build.rs"
1717
workspace = "../.."
1818
edition = "2021"
19-
rust-version = "1.70"
19+
rust-version = "1.74.0"
2020

2121
[[bin]]
2222
bench = false

0 commit comments

Comments
 (0)