File tree Expand file tree Collapse file tree 6 files changed +16
-25
lines changed Expand file tree Collapse file tree 6 files changed +16
-25
lines changed Original file line number Diff line number Diff line change @@ -61,10 +61,11 @@ fn simple_bin() {
61
61
fn simple_git_ignore_exists ( ) {
62
62
// write a .gitignore file with one entry
63
63
fs:: create_dir_all ( paths:: root ( ) . join ( "foo" ) ) . unwrap ( ) ;
64
- let mut ignore_file = File :: create ( paths:: root ( ) . join ( "foo/.gitignore" ) ) . unwrap ( ) ;
65
- ignore_file
66
- . write ( "/target\n **/some.file" . as_bytes ( ) )
67
- . unwrap ( ) ;
64
+ fs:: write (
65
+ paths:: root ( ) . join ( "foo/.gitignore" ) ,
66
+ "/target\n **/some.file" ,
67
+ )
68
+ . unwrap ( ) ;
68
69
69
70
cargo_process ( "init --lib foo --edition 2015" )
70
71
. env ( "USER" , "foo" )
Original file line number Diff line number Diff line change @@ -1343,7 +1343,7 @@ fn install_global_cargo_config() {
1343
1343
pkg ( "bar" , "0.0.1" ) ;
1344
1344
1345
1345
let config = cargo_home ( ) . join ( "config" ) ;
1346
- let mut toml = fs:: read_to_string ( & config) . unwrap_or ( String :: new ( ) ) ;
1346
+ let mut toml = fs:: read_to_string ( & config) . unwrap_or_default ( ) ;
1347
1347
1348
1348
toml. push_str (
1349
1349
r#"
Original file line number Diff line number Diff line change @@ -434,8 +434,7 @@ fn metabuild_metadata() {
434
434
. as_array ( )
435
435
. unwrap ( )
436
436
. iter ( )
437
- . filter ( |p| p[ "name" ] . as_str ( ) . unwrap ( ) == "foo" )
438
- . next ( )
437
+ . find ( |p| p[ "name" ] . as_str ( ) . unwrap ( ) == "foo" )
439
438
. unwrap ( ) [ "metabuild" ]
440
439
. as_array ( )
441
440
. unwrap ( )
Original file line number Diff line number Diff line change @@ -112,10 +112,10 @@ proptest! {
112
112
let reg = registry( input. clone( ) ) ;
113
113
let mut removed_input = input. clone( ) ;
114
114
for ( summery_idx, dep_idx) in indexes_to_remove {
115
- if removed_input. len ( ) > 0 {
115
+ if ! removed_input. is_empty ( ) {
116
116
let summery_idx = summery_idx. index( removed_input. len( ) ) ;
117
117
let deps = removed_input[ summery_idx] . dependencies( ) ;
118
- if deps. len ( ) > 0 {
118
+ if ! deps. is_empty ( ) {
119
119
let new = remove_dep( & removed_input[ summery_idx] , dep_idx. index( deps. len( ) ) ) ;
120
120
removed_input[ summery_idx] = new;
121
121
}
Original file line number Diff line number Diff line change @@ -1084,10 +1084,7 @@ impl Execs {
1084
1084
1085
1085
// On Windows, we need to use a wildcard for the drive,
1086
1086
// because we don't actually know what it will be.
1087
- let replaced =
1088
- replaced. replace ( "[ROOT]" , if cfg ! ( windows) { r#"[..]:\"# } else { "/" } ) ;
1089
-
1090
- replaced
1087
+ replaced. replace ( "[ROOT]" , if cfg ! ( windows) { r#"[..]:\"# } else { "/" } )
1091
1088
}
1092
1089
None => return Ok ( ( ) ) ,
1093
1090
} ;
Original file line number Diff line number Diff line change @@ -188,13 +188,11 @@ fn custom_runner_cfg() {
188
188
189
189
p. cargo ( "run -- --param" )
190
190
. with_status ( 101 )
191
- . with_stderr_contains ( & format ! (
192
- "\
191
+ . with_stderr_contains ( "\
193
192
[COMPILING] foo v0.0.1 ([CWD])
194
193
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
195
194
[RUNNING] `nonexistent-runner -r target/debug/foo[EXE] --param`
196
- " ,
197
- ) )
195
+ " )
198
196
. run ( ) ;
199
197
}
200
198
@@ -222,13 +220,11 @@ fn custom_runner_cfg_precedence() {
222
220
223
221
p. cargo ( "run -- --param" )
224
222
. with_status ( 101 )
225
- . with_stderr_contains ( & format ! (
226
- "\
223
+ . with_stderr_contains ( "\
227
224
[COMPILING] foo v0.0.1 ([CWD])
228
225
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
229
226
[RUNNING] `nonexistent-runner -r target/debug/foo[EXE] --param`
230
- " ,
231
- ) )
227
+ " )
232
228
. run ( ) ;
233
229
}
234
230
@@ -250,10 +246,8 @@ fn custom_runner_cfg_collision() {
250
246
251
247
p. cargo ( "run -- --param" )
252
248
. with_status ( 101 )
253
- . with_stderr_contains ( & format ! (
254
- "\
249
+ . with_stderr_contains ( "\
255
250
[ERROR] several matching instances of `target.'cfg(..)'.runner` in `.cargo/config`
256
- " ,
257
- ) )
251
+ " )
258
252
. run ( ) ;
259
253
}
You can’t perform that action at this time.
0 commit comments