File tree Expand file tree Collapse file tree 4 files changed +10
-14
lines changed Expand file tree Collapse file tree 4 files changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -713,7 +713,7 @@ mod tests {
713
713
name : "hello-rs" . into ( ) ,
714
714
sha : None ,
715
715
} ;
716
- let gh = Crate :: GitHub ( repo. clone ( ) ) ;
716
+ let gh = Crate :: GitHub ( repo) ;
717
717
718
718
let index = Index :: new ( WORK_DIR . join ( "crates.io-index" ) ) ;
719
719
index. retrieve_or_update ( ) . unwrap ( ) ;
@@ -745,7 +745,7 @@ mod tests {
745
745
name : "hello-rs" . into ( ) ,
746
746
sha : None ,
747
747
} ;
748
- let gh = Crate :: GitHub ( repo. clone ( ) ) ;
748
+ let gh = Crate :: GitHub ( repo) ;
749
749
750
750
assert_eq ! (
751
751
crate_to_url( & gh) . unwrap( ) ,
@@ -884,7 +884,7 @@ mod tests {
884
884
name : "hello-rs" . into ( ) ,
885
885
sha : Some ( "f00" . into ( ) ) ,
886
886
} ;
887
- let gh = Crate :: GitHub ( repo. clone ( ) ) ;
887
+ let gh = Crate :: GitHub ( repo) ;
888
888
let reg = Crate :: Registry ( RegistryCrate {
889
889
name : "syn" . into ( ) ,
890
890
version : "1.0.0" . into ( ) ,
Original file line number Diff line number Diff line change @@ -230,7 +230,7 @@ mod tests {
230
230
WriteResults ,
231
231
} ;
232
232
use crate :: toolchain:: { MAIN_TOOLCHAIN , TEST_TOOLCHAIN } ;
233
- use base64 ;
233
+
234
234
use std:: collections:: BTreeSet ;
235
235
236
236
#[ test]
@@ -434,7 +434,7 @@ mod tests {
434
434
435
435
assert_eq ! (
436
436
results. load_log( & ex, & MAIN_TOOLCHAIN , & updated) . unwrap( ) ,
437
- Some ( EncodedLog :: Plain ( "foo" . as_bytes ( ) . to_vec( ) ) )
437
+ Some ( EncodedLog :: Plain ( b "foo". to_vec( ) ) )
438
438
) ;
439
439
assert_eq ! (
440
440
results
Original file line number Diff line number Diff line change @@ -62,11 +62,7 @@ pub(super) enum WalkResult {
62
62
63
63
impl WalkResult {
64
64
pub ( super ) fn is_finished ( & self ) -> bool {
65
- if let WalkResult :: Finished = self {
66
- true
67
- } else {
68
- false
69
- }
65
+ matches ! ( self , WalkResult :: Finished )
70
66
}
71
67
}
72
68
Original file line number Diff line number Diff line change @@ -59,13 +59,13 @@ trait Compare {
59
59
let actual_file = ex_dir. join ( expand_file_names ( file, ".actual" ) ) ;
60
60
let expected_file = ex_dir. join ( expand_file_names ( file, ".expected" ) ) ;
61
61
// Load actual report
62
- let raw_report =
63
- :: std :: fs :: read ( file_dir . join ( file ) ) . expect ( & format ! ( "failed to read {}" , file) ) ;
62
+ let raw_report = :: std :: fs :: read ( file_dir . join ( file ) )
63
+ . unwrap_or_else ( |_| panic ! ( "failed to read {}" , file) ) ;
64
64
// Test report format
65
65
let actual_report = self . format ( raw_report) ;
66
66
67
67
// Load the expected report
68
- let expected_report = :: std:: fs:: read ( & expected_file) . unwrap_or ( Vec :: new ( ) ) ;
68
+ let expected_report = :: std:: fs:: read ( & expected_file) . unwrap_or_default ( ) ;
69
69
70
70
// Write the actual JSON report
71
71
:: std:: fs:: write ( & actual_file, & actual_report)
@@ -92,7 +92,7 @@ trait Compare {
92
92
failed = true ;
93
93
}
94
94
}
95
- return failed;
95
+ failed
96
96
}
97
97
}
98
98
You can’t perform that action at this time.
0 commit comments