Skip to content

Commit 782dacd

Browse files
committed
Replaced the match arm with better coding convention.
1 parent 38694d4 commit 782dacd

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/cargo/ops/cargo_new.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -649,15 +649,8 @@ fn mk(config: &Config, opts: &MkOptions<'_>) -> CargoResult<()> {
649649

650650
// "Name <email>" or "Name" or "<email>" or None if neither name nor email is obtained
651651
// cfg takes priority over the discovered ones
652-
let author_name = match (cfg.name, discovered_name) {
653-
(Some(name), _) | (_, Some(name)) => Some(name),
654-
(None, None) => None,
655-
};
656-
657-
let author_email = match (cfg.email, discovered_email) {
658-
(Some(email), _) | (_, Some(email)) => Some(email),
659-
(None, None) => None,
660-
};
652+
let author_name = cfg.name.or(discovered_name);
653+
let author_email = cfg.email.or(discovered_email);
661654

662655
let author = match (author_name, author_email) {
663656
(Some(name), Some(email)) => {

0 commit comments

Comments
 (0)