Skip to content

Commit f76f679

Browse files
scepter914Copilot
andauthored
Update src/rack.rs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 179081c commit f76f679

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

src/rack.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,20 @@ pub struct ProjectConfig {
6666

6767
impl ProjectConfig {
6868
pub fn is_valid_version(&self, path_from_config_dir: &PathBuf) -> bool {
69-
let project_name = path_from_config_dir
69+
let project_name = match path_from_config_dir
7070
.parent()
71-
.unwrap()
72-
.to_str()
73-
.unwrap()
74-
.to_string();
75-
let version = path_from_config_dir
71+
.and_then(|p| p.to_str())
72+
{
73+
Some(s) => s.to_string(),
74+
None => return false,
75+
};
76+
let version = match path_from_config_dir
7677
.file_name()
77-
.unwrap()
78-
.to_str()
79-
.unwrap()
80-
.to_string();
78+
.and_then(|n| n.to_str())
79+
{
80+
Some(s) => s.to_string(),
81+
None => return false,
82+
};
8183
let version_elements: Vec<String> = version.split('.').map(|s| s.to_string()).collect();
8284

8385
if self.is_yyyymmdd_project(&project_name) {

0 commit comments

Comments
 (0)