Skip to content

Commit 4db8b5b

Browse files
committed
Auto merge of #32238 - frewsxcv:compiletest, r=alexcrichton
Utilize `Option::cloned` over explicit `clone` usage.
2 parents 34b95a3 + 8f008ba commit 4db8b5b

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

src/compiletest/compiletest.rs

+2-11
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,6 @@ pub fn parse_config(args: Vec<String> ) -> Config {
116116
}
117117
}
118118

119-
let filter = if !matches.free.is_empty() {
120-
Some(matches.free[0].clone())
121-
} else {
122-
None
123-
};
124-
125119
Config {
126120
compile_lib_path: matches.opt_str("compile-lib-path").unwrap(),
127121
run_lib_path: matches.opt_str("run-lib-path").unwrap(),
@@ -137,7 +131,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
137131
stage_id: matches.opt_str("stage-id").unwrap(),
138132
mode: matches.opt_str("mode").unwrap().parse().ok().expect("invalid mode"),
139133
run_ignored: matches.opt_present("ignored"),
140-
filter: filter,
134+
filter: matches.free.first().cloned(),
141135
logfile: matches.opt_str("logfile").map(|s| PathBuf::from(&s)),
142136
runtool: matches.opt_str("runtool"),
143137
host_rustcflags: matches.opt_str("host-rustcflags"),
@@ -251,10 +245,7 @@ pub fn run_tests(config: &Config) {
251245

252246
pub fn test_opts(config: &Config) -> test::TestOpts {
253247
test::TestOpts {
254-
filter: match config.filter {
255-
None => None,
256-
Some(ref filter) => Some(filter.clone()),
257-
},
248+
filter: config.filter.clone(),
258249
run_ignored: config.run_ignored,
259250
logfile: config.logfile.clone(),
260251
run_tests: true,

0 commit comments

Comments
 (0)