File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -742,12 +742,12 @@ pub(crate) async fn update_from_dist(
742742 opts : & DistOptions < ' _ > ,
743743) -> Result < Option < String > > {
744744 let fresh_install = !prefix. path ( ) . exists ( ) ;
745- let hash_exists = opts. update_hash . map ( Path :: exists ) . unwrap_or ( false ) ;
746- // fresh_install means the toolchain isn't present, but hash_exists means there is a stray hash file
747- if fresh_install && hash_exists {
748- // It's ok to unwrap, because hash have to exist at this point
749- ( opts . dl_cfg . notify_handler ) ( Notification :: StrayHash ( opts . update_hash . unwrap ( ) ) ) ;
750- std :: fs :: remove_file ( opts . update_hash . unwrap ( ) ) ? ;
745+ if let Some ( hash ) = opts. update_hash {
746+ // fresh_install means the toolchain isn't present, but hash_exists means there is a stray hash file
747+ if fresh_install && Path :: exists ( hash ) {
748+ ( opts . dl_cfg . notify_handler ) ( Notification :: StrayHash ( hash) ) ;
749+ std :: fs :: remove_file ( hash ) ? ;
750+ }
751751 }
752752
753753 let res = update_from_dist_ (
You can’t perform that action at this time.
0 commit comments