Skip to content

Commit 9b3e6f7

Browse files
committed
changed return type as discover_author no longer bails
Return type changed to plain tuples instead of CargoResult as the function does not bail with error if the author name is missing.
1 parent 917fc99 commit 9b3e6f7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/cargo/ops/cargo_new.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ fn mk(config: &Config, opts: &MkOptions<'_>) -> CargoResult<()> {
645645
init_vcs(path, vcs, config)?;
646646
write_ignore_file(path, &ignore, vcs)?;
647647

648-
let (discovered_name, discovered_email) = discover_author(path)?;
648+
let (discovered_name, discovered_email) = discover_author(path);
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
@@ -802,7 +802,7 @@ fn get_environment_variable(variables: &[&str]) -> Option<String> {
802802
variables.iter().filter_map(|var| env::var(var).ok()).next()
803803
}
804804

805-
fn discover_author(path: &Path) -> CargoResult<(Option<String>, Option<String>)> {
805+
fn discover_author(path: &Path) -> (Option<String>, Option<String>) {
806806
let git_config = find_git_config(path);
807807
let git_config = git_config.as_ref();
808808

@@ -845,7 +845,7 @@ fn discover_author(path: &Path) -> CargoResult<(Option<String>, Option<String>)>
845845
s.to_string()
846846
});
847847

848-
Ok((name, email))
848+
(name, email)
849849
}
850850

851851
fn find_git_config(path: &Path) -> Option<GitConfig> {

0 commit comments

Comments
 (0)