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;
6
6
use crate :: util:: Config ;
7
7
use crate :: util:: Filesystem ;
8
8
use anyhow:: bail;
9
- use cargo_util:: paths;
10
9
use std:: collections:: BTreeSet ;
11
10
use std:: env;
12
11
@@ -103,7 +102,6 @@ fn uninstall_pkgid(
103
102
bins : & [ String ] ,
104
103
config : & Config ,
105
104
) -> CargoResult < ( ) > {
106
- let mut to_remove = Vec :: new ( ) ;
107
105
let installed = match tracker. installed_bins ( pkgid) {
108
106
Some ( bins) => bins. clone ( ) ,
109
107
None => bail ! ( "package `{}` is not installed" , pkgid) ,
@@ -137,11 +135,13 @@ fn uninstall_pkgid(
137
135
}
138
136
}
139
137
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
+ } ;
145
145
146
146
for bin in to_remove {
147
147
let bin_path = dst. join ( bin) ;
Original file line number Diff line number Diff line change @@ -2530,9 +2530,7 @@ fn uninstall_running_binary() {
2530
2530
r#"
2531
2531
use std::{{thread, time}};
2532
2532
fn main() {
2533
- println!("start longrunning job.");
2534
2533
thread::sleep(time::Duration::from_secs(3));
2535
- println!("end longrunning job.");
2536
2534
}
2537
2535
"# ,
2538
2536
)
You can’t perform that action at this time.
0 commit comments