Skip to content

Commit 0f1534c

Browse files
committed
refactor: simplify match -> if let
1 parent 5e3dc46 commit 0f1534c

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/bin/cargo/commands/run.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,14 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
4040
)?;
4141

4242
// Disallow `spec` to be an glob pattern
43-
match &compile_opts.spec {
44-
Packages::Packages(opt_in) => {
45-
if let Some(pattern) = opt_in.iter().find(|s| is_glob_pattern(s)) {
46-
return Err(anyhow::anyhow!(
47-
"`cargo run` does not support glob pattern `{}` on package selection",
48-
pattern,
49-
)
50-
.into());
51-
}
43+
if let Packages::Packages(opt_in) = &compile_opts.spec {
44+
if let Some(pattern) = opt_in.iter().find(|s| is_glob_pattern(s)) {
45+
return Err(anyhow::anyhow!(
46+
"`cargo run` does not support glob pattern `{}` on package selection",
47+
pattern,
48+
)
49+
.into());
5250
}
53-
_ => (),
5451
}
5552

5653
if !args.is_present("example") && !args.is_present("bin") {

0 commit comments

Comments
 (0)