File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,18 +66,20 @@ pub struct ProjectConfig {
6666
6767impl 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) {
You can’t perform that action at this time.
0 commit comments