Skip to content

Commit 1e1201b

Browse files
committed
[nextest-runner] lift @global into a const
1 parent ffd6a8c commit 1e1201b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

nextest-runner/src/config/test_group.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ pub enum TestGroup {
1818
}
1919

2020
impl TestGroup {
21+
/// The string `"@global"`, indicating the global test group.
22+
pub const GLOBAL_STR: &'static str = "@global";
23+
2124
pub(crate) fn make_all_groups(
2225
custom_groups: impl IntoIterator<Item = CustomTestGroup>,
2326
) -> impl Iterator<Item = Self> {
@@ -36,7 +39,7 @@ impl<'de> Deserialize<'de> for TestGroup {
3639
// Try and deserialize the group as a string. (Note: we don't deserialize a
3740
// `CustomTestGroup` directly because that errors out on None.
3841
let group = SmolStr::deserialize(deserializer)?;
39-
if group == "@global" {
42+
if group == Self::GLOBAL_STR {
4043
Ok(TestGroup::Global)
4144
} else {
4245
Ok(TestGroup::Custom(
@@ -50,7 +53,7 @@ impl FromStr for TestGroup {
5053
type Err = InvalidCustomTestGroupName;
5154

5255
fn from_str(s: &str) -> Result<Self, Self::Err> {
53-
if s == "@global" {
56+
if s == Self::GLOBAL_STR {
5457
Ok(TestGroup::Global)
5558
} else {
5659
Ok(TestGroup::Custom(CustomTestGroup::new(s.into())?))

0 commit comments

Comments
 (0)