Skip to content

Commit 8bd5210

Browse files
committed
Tune up Cargo features according to 1.60 Rust and bump up MSRV
1 parent 169d861 commit 8bd5210

File tree

8 files changed

+92
-162
lines changed

8 files changed

+92
-162
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ jobs:
124124
strategy:
125125
fail-fast: false
126126
matrix:
127-
msrv: ["1.56.0"]
127+
msrv: ["1.60.0"]
128128
os:
129129
- ubuntu
130130
- macOS

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ All user visible changes to `cucumber-expressions` crate will be documented in t
66

77

88

9+
## [0.3.0] · 2022-??-?? (unreleased)
10+
[0.3.0]: /../../tree/v0.3.0
11+
12+
[Diff](/../../compare/v0.2.1...v0.3.0)
13+
14+
### BC Breaks
15+
16+
- Bumped up [MSRV] to 1.60 for more clever support of [Cargo feature]s.
17+
18+
19+
20+
921
## [0.2.1] · 2022-03-09
1022
[0.2.1]: /../../tree/v0.2.1
1123

@@ -89,5 +101,7 @@ All user visible changes to `cucumber-expressions` crate will be documented in t
89101

90102
[`Regex`]: https://docs.rs/regex
91103

104+
[Cargo feature]: https://doc.rust-lang.org/cargo/reference/features.html
92105
[Cucumber Expressions]: https://github.com/cucumber/cucumber-expressions#readme
106+
[MSRV]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field
93107
[Semantic Versioning 2.0.0]: https://semver.org

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "cucumber-expressions"
3-
version = "0.2.1"
3+
version = "0.3.0-dev"
44
edition = "2021"
5-
rust-version = "1.56"
5+
rust-version = "1.60"
66
description = "Cucumber Expressions AST and parser."
77
license = "MIT OR Apache-2.0"
88
authors = [
@@ -23,7 +23,7 @@ rustdoc-args = ["--cfg", "docsrs"]
2323

2424
[features]
2525
# Enables ability to expand AST into regex.
26-
into-regex = ["either", "regex", "regex-syntax"]
26+
into-regex = ["dep:either", "dep:regex", "dep:regex-syntax"]
2727

2828
[dependencies]
2929
derive_more = { version = "0.99.17", features = ["as_ref", "deref", "deref_mut", "display", "error", "from", "into"], default_features = false }

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
[Cucumber Expressions] for Rust
22
===============================
33

4+
[![Crates.io](https://img.shields.io/crates/v/cucumber-expressions.svg?maxAge=2592000)](https://crates.io/crates/cucumber-expressions)
45
[![Documentation](https://docs.rs/cucumber-expressions/badge.svg)](https://docs.rs/cucumber-expressions)
56
[![CI](https://github.com/cucumber-rs/cucumber-expressions/workflows/CI/badge.svg?branch=main "CI")](https://github.com/cucumber-rs/cucumber-expressions/actions?query=workflow%3ACI+branch%3Amaster)
6-
[![Rust 1.56+](https://img.shields.io/badge/rustc-1.56+-lightgray.svg "Rust 1.56+")](https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html)
7+
[![Rust 1.60+](https://img.shields.io/badge/rustc-1.60+-lightgray.svg "Rust 1.60+")](https://blog.rust-lang.org/2022/04/07/Rust-1.60.0.html)
78
[![Unsafe Forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance)
89

910
- [Changelog](https://github.com/cucumber-rs/cucumber-expressions/blob/main/CHANGELOG.md)

fuzz/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "cucumber-expressions-fuzz"
33
version = "0.0.0"
44
edition = "2021"
5-
rust-version = "1.56"
5+
rust-version = "1.60"
66
description = "Fuzz testing for `cucumber-expressions` crate."
77
license = "MIT OR Apache-2.0"
88
authors = [

src/expand/mod.rs

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -649,18 +649,16 @@ mod spec {
649649

650650
#[test]
651651
fn alternation_with_optional() {
652-
// TODO: Use "{e}" syntax once MSRV bumps above 1.58.
653652
let expr = Expression::regex("a/b(c)")
654-
.unwrap_or_else(|e| panic!("failed: {}", e));
653+
.unwrap_or_else(|e| panic!("failed: {e}"));
655654

656655
assert_eq!(expr.as_str(), "^(?:a|b(?:c)?)$");
657656
}
658657

659658
#[test]
660659
fn alternation() {
661-
// TODO: Use "{e}" syntax once MSRV bumps above 1.58.
662660
let expr = Expression::regex("a/b c/d/e")
663-
.unwrap_or_else(|e| panic!("failed: {}", e));
661+
.unwrap_or_else(|e| panic!("failed: {e}"));
664662

665663
assert_eq!(expr.as_str(), "^(?:a|b) (?:c|d|e)$");
666664
assert!(expr.is_match("a c"));
@@ -672,9 +670,8 @@ mod spec {
672670

673671
#[test]
674672
fn empty() {
675-
// TODO: Use "{e}" syntax once MSRV bumps above 1.58.
676673
let expr =
677-
Expression::regex("").unwrap_or_else(|e| panic!("failed: {}", e));
674+
Expression::regex("").unwrap_or_else(|e| panic!("failed: {e}"));
678675

679676
assert_eq!(expr.as_str(), "^$");
680677
assert!(expr.is_match(""));
@@ -683,19 +680,17 @@ mod spec {
683680

684681
#[test]
685682
fn escape_regex_characters() {
686-
// TODO: Use "{e}" syntax once MSRV bumps above 1.58.
687683
let expr = Expression::regex(r"^$[]\()\{}\\.|?*+")
688-
.unwrap_or_else(|e| panic!("failed: {}", e));
684+
.unwrap_or_else(|e| panic!("failed: {e}"));
689685

690686
assert_eq!(expr.as_str(), r"^\^\$\[\]\(\)\{\}\\\.\|\?\*\+$");
691687
assert!(expr.is_match("^$[](){}\\.|?*+"));
692688
}
693689

694690
#[test]
695691
fn optional() {
696-
// TODO: Use "{e}" syntax once MSRV bumps above 1.58.
697-
let expr = Expression::regex("(a)")
698-
.unwrap_or_else(|e| panic!("failed: {}", e));
692+
let expr =
693+
Expression::regex("(a)").unwrap_or_else(|e| panic!("failed: {e}"));
699694

700695
assert_eq!(expr.as_str(), "^(?:a)?$");
701696
assert!(expr.is_match(""));
@@ -705,9 +700,8 @@ mod spec {
705700

706701
#[test]
707702
fn parameter_int() {
708-
// TODO: Use "{e}" syntax once MSRV bumps above 1.58.
709703
let expr = Expression::regex("{int}")
710-
.unwrap_or_else(|e| panic!("failed: {}", e));
704+
.unwrap_or_else(|e| panic!("failed: {e}"));
711705

712706
assert_eq!(expr.as_str(), "^((?:-?\\d+)|(?:\\d+))$");
713707
assert!(expr.is_match("123"));
@@ -718,9 +712,8 @@ mod spec {
718712

719713
#[test]
720714
fn parameter_float() {
721-
// TODO: Use "{e}" syntax once MSRV bumps above 1.58.
722715
let expr = Expression::regex("{float}")
723-
.unwrap_or_else(|e| panic!("failed: {}", e));
716+
.unwrap_or_else(|e| panic!("failed: {e}"));
724717

725718
assert_eq!(
726719
expr.as_str(),
@@ -740,9 +733,8 @@ mod spec {
740733

741734
#[test]
742735
fn parameter_word() {
743-
// TODO: Use "{e}" syntax once MSRV bumps above 1.58.
744736
let expr = Expression::regex("{word}")
745-
.unwrap_or_else(|e| panic!("failed: {}", e));
737+
.unwrap_or_else(|e| panic!("failed: {e}"));
746738

747739
assert_eq!(expr.as_str(), "^([^\\s]+)$");
748740
assert!(expr.is_match("test"));
@@ -752,9 +744,8 @@ mod spec {
752744

753745
#[test]
754746
fn parameter_string() {
755-
// TODO: Use "{e}" syntax once MSRV bumps above 1.58.
756747
let expr = Expression::regex("{string}")
757-
.unwrap_or_else(|e| panic!("failed: {}", e));
748+
.unwrap_or_else(|e| panic!("failed: {e}"));
758749

759750
assert_eq!(
760751
expr.as_str(),
@@ -774,9 +765,8 @@ mod spec {
774765

775766
#[test]
776767
fn multiple_string_parameters() {
777-
// TODO: Use "{e}" syntax once MSRV bumps above 1.58.
778768
let expr = Expression::regex("{string} {string}")
779-
.unwrap_or_else(|e| panic!("failed: {}", e));
769+
.unwrap_or_else(|e| panic!("failed: {e}"));
780770

781771
assert_eq!(
782772
expr.as_str(),
@@ -798,19 +788,17 @@ mod spec {
798788

799789
#[test]
800790
fn parameter_all() {
801-
// TODO: Use "{e}" syntax once MSRV bumps above 1.58.
802791
let expr =
803-
Expression::regex("{}").unwrap_or_else(|e| panic!("failed: {}", e));
792+
Expression::regex("{}").unwrap_or_else(|e| panic!("failed: {e}"));
804793

805794
assert_eq!(expr.as_str(), "^(.*)$");
806795
assert!(expr.is_match("anything matches"));
807796
}
808797

809798
#[test]
810799
fn text() {
811-
// TODO: Use "{e}" syntax once MSRV bumps above 1.58.
812800
let expr =
813-
Expression::regex("a").unwrap_or_else(|e| panic!("failed: {}", e));
801+
Expression::regex("a").unwrap_or_else(|e| panic!("failed: {e}"));
814802

815803
assert_eq!(expr.as_str(), "^a$");
816804
assert!(expr.is_match("a"));
@@ -820,9 +808,8 @@ mod spec {
820808

821809
#[test]
822810
fn unicode() {
823-
// TODO: Use "{e}" syntax once MSRV bumps above 1.58.
824811
let expr = Expression::regex("Привет, Мир(ы)!")
825-
.unwrap_or_else(|e| panic!("failed: {}", e));
812+
.unwrap_or_else(|e| panic!("failed: {e}"));
826813

827814
assert_eq!(expr.as_str(), "^Привет, Мир(?:ы)?!$");
828815
assert!(expr.is_match("Привет, Мир!"));
@@ -837,8 +824,7 @@ mod spec {
837824
assert_eq!(*not_found, "custom");
838825
}
839826
e @ (Error::Parsing(_) | Error::Regex(_) | Error::Expansion(_)) => {
840-
// TODO: Use "{e}" syntax once MSRV bumps above 1.58.
841-
panic!("wrong err: {}", e);
827+
panic!("wrong err: {e}");
842828
}
843829
}
844830
}

src/expand/parameters.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -362,11 +362,9 @@ mod regex_hir {
362362
hir::GroupKind::CaptureIndex(index)
363363
| hir::GroupKind::CaptureName { index, .. } => {
364364
group.kind = hir::GroupKind::CaptureName {
365-
// TODO: Use "__{parameter_id}_{}" syntax once MSRV
366-
// bumps above 1.58.
367365
name: format!(
368-
"__{}_{}",
369-
parameter_id, *group_id_indexer,
366+
"__{parameter_id}_{}",
367+
*group_id_indexer,
370368
),
371369
index,
372370
};
@@ -415,20 +413,18 @@ mod spec {
415413
#[test]
416414
fn custom_parameter() {
417415
let pars = HashMap::from([("custom", "custom")]);
418-
// TODO: Use "{e}" syntax once MSRV bumps above 1.58.
419416
let expr = Expression::regex_with_parameters("{custom}", &pars)
420-
.unwrap_or_else(|e| panic!("failed: {}", e));
417+
.unwrap_or_else(|e| panic!("failed: {e}"));
421418

422419
assert_eq!(expr.as_str(), "^(custom)$");
423420
}
424421

425422
#[test]
426423
fn custom_parameter_with_groups() {
427424
let pars = HashMap::from([("custom", "\"(custom)\"|'(custom)'")]);
428-
// TODO: Use "{e}" syntax once MSRV bumps above 1.58.
429425
let expr =
430426
Expression::regex_with_parameters("{custom} {custom}", &pars)
431-
.unwrap_or_else(|e| panic!("failed: {}", e));
427+
.unwrap_or_else(|e| panic!("failed: {e}"));
432428

433429
assert_eq!(
434430
expr.as_str(),
@@ -440,9 +436,8 @@ mod spec {
440436
#[test]
441437
fn default_parameter() {
442438
let pars = HashMap::from([("custom", "custom")]);
443-
// TODO: Use "{e}" syntax once MSRV bumps above 1.58.
444439
let expr = Expression::regex_with_parameters("{}", &pars)
445-
.unwrap_or_else(|e| panic!("failed: {}", e));
440+
.unwrap_or_else(|e| panic!("failed: {e}"));
446441

447442
assert_eq!(expr.as_str(), "^(.*)$");
448443
}
@@ -457,8 +452,7 @@ mod spec {
457452
assert_eq!(*not_found, "custom");
458453
}
459454
e @ (Error::Regex(_) | Error::Parsing(_) | Error::Expansion(_)) => {
460-
// TODO: Use "{e}" syntax once MSRV bumps above 1.58.
461-
panic!("wrong err: {}", e)
455+
panic!("wrong err: {e}")
462456
}
463457
}
464458
}

0 commit comments

Comments
 (0)