Skip to content

Commit 2a899a9

Browse files
committed
Fix clippy warnings in tests
from needless_borrows_for_generic_args lint
1 parent 6ec8370 commit 2a899a9

File tree

4 files changed

+87
-87
lines changed

4 files changed

+87
-87
lines changed

src/context_diff.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -439,26 +439,26 @@ mod tests {
439439
..Default::default()
440440
},
441441
);
442-
File::create(&format!("{target}/ab.diff"))
442+
File::create(format!("{target}/ab.diff"))
443443
.unwrap()
444444
.write_all(&diff)
445445
.unwrap();
446-
let mut fa = File::create(&format!("{target}/alef")).unwrap();
446+
let mut fa = File::create(format!("{target}/alef")).unwrap();
447447
fa.write_all(&alef[..]).unwrap();
448-
let mut fb = File::create(&format!("{target}/bet")).unwrap();
448+
let mut fb = File::create(format!("{target}/bet")).unwrap();
449449
fb.write_all(&bet[..]).unwrap();
450450
let _ = fa;
451451
let _ = fb;
452452
let output = Command::new("patch")
453453
.arg("-p0")
454454
.arg("--context")
455-
.stdin(File::open(&format!("{target}/ab.diff")).unwrap())
455+
.stdin(File::open(format!("{target}/ab.diff")).unwrap())
456456
.output()
457457
.unwrap();
458458
assert!(output.status.success(), "{output:?}");
459459
//println!("{}", String::from_utf8_lossy(&output.stdout));
460460
//println!("{}", String::from_utf8_lossy(&output.stderr));
461-
let alef = fs::read(&format!("{target}/alef")).unwrap();
461+
let alef = fs::read(format!("{target}/alef")).unwrap();
462462
assert_eq!(alef, bet);
463463
}
464464
}
@@ -520,26 +520,26 @@ mod tests {
520520
..Default::default()
521521
},
522522
);
523-
File::create(&format!("{target}/ab_.diff"))
523+
File::create(format!("{target}/ab_.diff"))
524524
.unwrap()
525525
.write_all(&diff)
526526
.unwrap();
527-
let mut fa = File::create(&format!("{target}/alef_")).unwrap();
527+
let mut fa = File::create(format!("{target}/alef_")).unwrap();
528528
fa.write_all(&alef[..]).unwrap();
529-
let mut fb = File::create(&format!("{target}/bet_")).unwrap();
529+
let mut fb = File::create(format!("{target}/bet_")).unwrap();
530530
fb.write_all(&bet[..]).unwrap();
531531
let _ = fa;
532532
let _ = fb;
533533
let output = Command::new("patch")
534534
.arg("-p0")
535535
.arg("--context")
536-
.stdin(File::open(&format!("{target}/ab_.diff")).unwrap())
536+
.stdin(File::open(format!("{target}/ab_.diff")).unwrap())
537537
.output()
538538
.unwrap();
539539
assert!(output.status.success(), "{output:?}");
540540
//println!("{}", String::from_utf8_lossy(&output.stdout));
541541
//println!("{}", String::from_utf8_lossy(&output.stderr));
542-
let alef = fs::read(&format!("{target}/alef_")).unwrap();
542+
let alef = fs::read(format!("{target}/alef_")).unwrap();
543543
assert_eq!(alef, bet);
544544
}
545545
}
@@ -604,26 +604,26 @@ mod tests {
604604
..Default::default()
605605
},
606606
);
607-
File::create(&format!("{target}/abx.diff"))
607+
File::create(format!("{target}/abx.diff"))
608608
.unwrap()
609609
.write_all(&diff)
610610
.unwrap();
611-
let mut fa = File::create(&format!("{target}/alefx")).unwrap();
611+
let mut fa = File::create(format!("{target}/alefx")).unwrap();
612612
fa.write_all(&alef[..]).unwrap();
613-
let mut fb = File::create(&format!("{target}/betx")).unwrap();
613+
let mut fb = File::create(format!("{target}/betx")).unwrap();
614614
fb.write_all(&bet[..]).unwrap();
615615
let _ = fa;
616616
let _ = fb;
617617
let output = Command::new("patch")
618618
.arg("-p0")
619619
.arg("--context")
620-
.stdin(File::open(&format!("{target}/abx.diff")).unwrap())
620+
.stdin(File::open(format!("{target}/abx.diff")).unwrap())
621621
.output()
622622
.unwrap();
623623
assert!(output.status.success(), "{output:?}");
624624
//println!("{}", String::from_utf8_lossy(&output.stdout));
625625
//println!("{}", String::from_utf8_lossy(&output.stderr));
626-
let alef = fs::read(&format!("{target}/alefx")).unwrap();
626+
let alef = fs::read(format!("{target}/alefx")).unwrap();
627627
assert_eq!(alef, bet);
628628
}
629629
}
@@ -691,26 +691,26 @@ mod tests {
691691
..Default::default()
692692
},
693693
);
694-
File::create(&format!("{target}/abr.diff"))
694+
File::create(format!("{target}/abr.diff"))
695695
.unwrap()
696696
.write_all(&diff)
697697
.unwrap();
698-
let mut fa = File::create(&format!("{target}/alefr")).unwrap();
698+
let mut fa = File::create(format!("{target}/alefr")).unwrap();
699699
fa.write_all(&alef[..]).unwrap();
700-
let mut fb = File::create(&format!("{target}/betr")).unwrap();
700+
let mut fb = File::create(format!("{target}/betr")).unwrap();
701701
fb.write_all(&bet[..]).unwrap();
702702
let _ = fa;
703703
let _ = fb;
704704
let output = Command::new("patch")
705705
.arg("-p0")
706706
.arg("--context")
707-
.stdin(File::open(&format!("{target}/abr.diff")).unwrap())
707+
.stdin(File::open(format!("{target}/abr.diff")).unwrap())
708708
.output()
709709
.unwrap();
710710
assert!(output.status.success(), "{output:?}");
711711
//println!("{}", String::from_utf8_lossy(&output.stdout));
712712
//println!("{}", String::from_utf8_lossy(&output.stderr));
713-
let alef = fs::read(&format!("{target}/alefr")).unwrap();
713+
let alef = fs::read(format!("{target}/alefr")).unwrap();
714714
assert_eq!(alef, bet);
715715
}
716716
}

src/ed_diff.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -225,28 +225,28 @@ mod tests {
225225
// This test diff is intentionally reversed.
226226
// We want it to turn the alef into bet.
227227
let diff = diff_w(&alef, &bet, &format!("{target}/alef")).unwrap();
228-
File::create(&format!("{target}/ab.ed"))
228+
File::create(format!("{target}/ab.ed"))
229229
.unwrap()
230230
.write_all(&diff)
231231
.unwrap();
232-
let mut fa = File::create(&format!("{target}/alef")).unwrap();
232+
let mut fa = File::create(format!("{target}/alef")).unwrap();
233233
fa.write_all(&alef[..]).unwrap();
234-
let mut fb = File::create(&format!("{target}/bet")).unwrap();
234+
let mut fb = File::create(format!("{target}/bet")).unwrap();
235235
fb.write_all(&bet[..]).unwrap();
236236
let _ = fa;
237237
let _ = fb;
238238
#[cfg(not(windows))] // there's no ed on windows
239239
{
240240
use std::process::Command;
241241
let output = Command::new("ed")
242-
.arg(&format!("{target}/alef"))
243-
.stdin(File::open(&format!("{target}/ab.ed")).unwrap())
242+
.arg(format!("{target}/alef"))
243+
.stdin(File::open(format!("{target}/ab.ed")).unwrap())
244244
.output()
245245
.unwrap();
246246
assert!(output.status.success(), "{output:?}");
247247
//println!("{}", String::from_utf8_lossy(&output.stdout));
248248
//println!("{}", String::from_utf8_lossy(&output.stderr));
249-
let alef = std::fs::read(&format!("{target}/alef")).unwrap();
249+
let alef = std::fs::read(format!("{target}/alef")).unwrap();
250250
assert_eq!(alef, bet);
251251
}
252252
}
@@ -299,28 +299,28 @@ mod tests {
299299
// This test diff is intentionally reversed.
300300
// We want it to turn the alef into bet.
301301
let diff = diff_w(&alef, &bet, &format!("{target}/alef_")).unwrap();
302-
File::create(&format!("{target}/ab_.ed"))
302+
File::create(format!("{target}/ab_.ed"))
303303
.unwrap()
304304
.write_all(&diff)
305305
.unwrap();
306-
let mut fa = File::create(&format!("{target}/alef_")).unwrap();
306+
let mut fa = File::create(format!("{target}/alef_")).unwrap();
307307
fa.write_all(&alef[..]).unwrap();
308-
let mut fb = File::create(&format!("{target}/bet_")).unwrap();
308+
let mut fb = File::create(format!("{target}/bet_")).unwrap();
309309
fb.write_all(&bet[..]).unwrap();
310310
let _ = fa;
311311
let _ = fb;
312312
#[cfg(not(windows))] // there's no ed on windows
313313
{
314314
use std::process::Command;
315315
let output = Command::new("ed")
316-
.arg(&format!("{target}/alef_"))
317-
.stdin(File::open(&format!("{target}/ab_.ed")).unwrap())
316+
.arg(format!("{target}/alef_"))
317+
.stdin(File::open(format!("{target}/ab_.ed")).unwrap())
318318
.output()
319319
.unwrap();
320320
assert!(output.status.success(), "{output:?}");
321321
//println!("{}", String::from_utf8_lossy(&output.stdout));
322322
//println!("{}", String::from_utf8_lossy(&output.stderr));
323-
let alef = std::fs::read(&format!("{target}/alef_")).unwrap();
323+
let alef = std::fs::read(format!("{target}/alef_")).unwrap();
324324
assert_eq!(alef, bet);
325325
}
326326
}
@@ -379,28 +379,28 @@ mod tests {
379379
// This test diff is intentionally reversed.
380380
// We want it to turn the alef into bet.
381381
let diff = diff_w(&alef, &bet, &format!("{target}/alefr")).unwrap();
382-
File::create(&format!("{target}/abr.ed"))
382+
File::create(format!("{target}/abr.ed"))
383383
.unwrap()
384384
.write_all(&diff)
385385
.unwrap();
386-
let mut fa = File::create(&format!("{target}/alefr")).unwrap();
386+
let mut fa = File::create(format!("{target}/alefr")).unwrap();
387387
fa.write_all(&alef[..]).unwrap();
388-
let mut fb = File::create(&format!("{target}/betr")).unwrap();
388+
let mut fb = File::create(format!("{target}/betr")).unwrap();
389389
fb.write_all(&bet[..]).unwrap();
390390
let _ = fa;
391391
let _ = fb;
392392
#[cfg(not(windows))] // there's no ed on windows
393393
{
394394
use std::process::Command;
395395
let output = Command::new("ed")
396-
.arg(&format!("{target}/alefr"))
397-
.stdin(File::open(&format!("{target}/abr.ed")).unwrap())
396+
.arg(format!("{target}/alefr"))
397+
.stdin(File::open(format!("{target}/abr.ed")).unwrap())
398398
.output()
399399
.unwrap();
400400
assert!(output.status.success(), "{output:?}");
401401
//println!("{}", String::from_utf8_lossy(&output.stdout));
402402
//println!("{}", String::from_utf8_lossy(&output.stderr));
403-
let alef = std::fs::read(&format!("{target}/alefr")).unwrap();
403+
let alef = std::fs::read(format!("{target}/alefr")).unwrap();
404404
assert_eq!(alef, bet);
405405
}
406406
}

0 commit comments

Comments
 (0)