Skip to content

Commit 02ccf0a

Browse files
feat: make measure mode always default to instrumentation
1 parent 54eb1b4 commit 02ccf0a

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

crates/cargo-codspeed/src/app.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ struct Cli {
1414

1515
/// The measurement tool to use for measuring performance.
1616
/// Automatically set to `walltime` on macro runners
17-
// This is an Option even if MeasurementMode has a default because
18-
// the default is dynamic and this would mislead the user
1917
#[arg(short, long, global = true, env = "CODSPEED_RUNNER_MODE")]
2018
measurement_mode: Option<MeasurementMode>,
2119

crates/cargo-codspeed/src/measurement_mode.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
use clap::ValueEnum;
22
use serde::Serialize;
3-
use std::{env, path::Path};
3+
use std::path::Path;
44

5-
#[derive(Debug, Clone, ValueEnum, Serialize, PartialEq, Eq)]
5+
#[derive(Debug, Clone, ValueEnum, Serialize, PartialEq, Eq, Default)]
66
#[serde(rename_all = "lowercase")]
77
pub enum MeasurementMode {
8-
Walltime,
8+
#[default]
99
Instrumentation,
10-
}
11-
12-
impl Default for MeasurementMode {
13-
fn default() -> Self {
14-
if env::var("CODSPEED_ENV").is_ok() {
15-
MeasurementMode::Instrumentation
16-
} else {
17-
MeasurementMode::Walltime
18-
}
19-
}
10+
Walltime,
2011
}
2112

2213
impl AsRef<Path> for MeasurementMode {

0 commit comments

Comments
 (0)