I think we can use join() method on the PathBuf directly to concatenate the segments, this will make the code more short and easier to read.
And instead of using unwrap() on the file_name() and to_str() methods, we can use unwrap_or_else() to provide a default value or an error handler function, this should prevent panics.
I think we can use join() method on the PathBuf directly to concatenate the segments, this will make the code more short and easier to read.
And instead of using unwrap() on the file_name() and to_str() methods, we can use unwrap_or_else() to provide a default value or an error handler function, this should prevent panics.