diff --git a/cargo-pgrx/src/command/get.rs b/cargo-pgrx/src/command/get.rs index f665d1d6ce..587fd1d99f 100644 --- a/cargo-pgrx/src/command/get.rs +++ b/cargo-pgrx/src/command/get.rs @@ -95,21 +95,19 @@ pub(crate) fn find_control_file( for f in std::fs::read_dir(parent).wrap_err_with(|| { eyre!("cannot open current directory `{}` for reading", parent.display()) })? { - if f.is_ok() { - if let Ok(f) = f { - let f_path = f.path(); - if f_path.extension() == Some("control".as_ref()) { - let file_stem = f_path.file_stem().ok_or_else(|| { - eyre!("could not get file stem of `{}`", f_path.display()) - })?; - let file_stem = file_stem - .to_str() - .ok_or_else(|| { - eyre!("could not get file stem as String from `{}`", f_path.display()) - })? - .to_string(); - return Ok((f_path, file_stem)); - } + if let Ok(f) = f { + let f_path = f.path(); + if f_path.extension() == Some("control".as_ref()) { + let file_stem = f_path + .file_stem() + .ok_or_else(|| eyre!("could not get file stem of `{}`", f_path.display()))?; + let file_stem = file_stem + .to_str() + .ok_or_else(|| { + eyre!("could not get file stem as String from `{}`", f_path.display()) + })? + .to_string(); + return Ok((f_path, file_stem)); } } }