File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ use crate::util::errors::CargoResult;
66use crate :: util:: Config ;
77use crate :: util:: Filesystem ;
88use anyhow:: bail;
9- use cargo_util:: paths;
109use std:: collections:: BTreeSet ;
1110use std:: env;
1211
@@ -103,7 +102,6 @@ fn uninstall_pkgid(
103102 bins : & [ String ] ,
104103 config : & Config ,
105104) -> CargoResult < ( ) > {
106- let mut to_remove = Vec :: new ( ) ;
107105 let installed = match tracker. installed_bins ( pkgid) {
108106 Some ( bins) => bins. clone ( ) ,
109107 None => bail ! ( "package `{}` is not installed" , pkgid) ,
@@ -137,11 +135,13 @@ fn uninstall_pkgid(
137135 }
138136 }
139137
140- if bins. is_empty ( ) {
141- to_remove = installed. iter ( ) . collect ( ) ;
142- } else {
143- to_remove = bins. iter ( ) . collect ( ) ;
144- }
138+ let to_remove: Vec < & String > = {
139+ if bins. is_empty ( ) {
140+ installed. iter ( ) . collect ( )
141+ } else {
142+ bins. iter ( ) . collect ( )
143+ }
144+ } ;
145145
146146 for bin in to_remove {
147147 let bin_path = dst. join ( bin) ;
Original file line number Diff line number Diff line change @@ -2530,9 +2530,7 @@ fn uninstall_running_binary() {
25302530 r#"
25312531 use std::{{thread, time}};
25322532 fn main() {
2533- println!("start longrunning job.");
25342533 thread::sleep(time::Duration::from_secs(3));
2535- println!("end longrunning job.");
25362534 }
25372535"# ,
25382536 )
You can’t perform that action at this time.
0 commit comments