File tree 6 files changed +17
-20
lines changed 6 files changed +17
-20
lines changed Original file line number Diff line number Diff line change @@ -84,4 +84,3 @@ impl ChildPath {
84
84
& self . path
85
85
}
86
86
}
87
-
Original file line number Diff line number Diff line change @@ -89,8 +89,7 @@ impl TempDir {
89
89
/// tmp_dir.close().unwrap();
90
90
/// ```
91
91
pub fn new ( ) -> Result < Self , FixtureError > {
92
- let temp = tempfile:: TempDir :: new ( )
93
- . chain ( FixtureError :: new ( FixtureKind :: CreateDir ) ) ?;
92
+ let temp = tempfile:: TempDir :: new ( ) . chain ( FixtureError :: new ( FixtureKind :: CreateDir ) ) ?;
94
93
let temp = Inner :: Temp ( temp) ;
95
94
Ok ( Self { temp } )
96
95
}
@@ -108,7 +107,7 @@ impl TempDir {
108
107
/// tmp_dir.close().unwrap();
109
108
/// ```
110
109
pub fn persist_if ( self , yes : bool ) -> Self {
111
- if ! yes {
110
+ if !yes {
112
111
return self ;
113
112
}
114
113
@@ -170,9 +169,9 @@ impl TempDir {
170
169
/// ```
171
170
pub fn close ( self ) -> Result < ( ) , FixtureError > {
172
171
match self . temp {
173
- Inner :: Temp ( temp) =>
174
- temp . close ( )
175
- . chain ( FixtureError :: new ( FixtureKind :: Cleanup ) ) ?,
172
+ Inner :: Temp ( temp) => temp
173
+ . close ( )
174
+ . chain ( FixtureError :: new ( FixtureKind :: Cleanup ) ) ?,
176
175
Inner :: Persisted ( _) => ( ) ,
177
176
}
178
177
Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -91,10 +91,9 @@ impl NamedTempFile {
91
91
/// ```
92
92
pub fn new < S > ( name : S ) -> Result < Self , FixtureError >
93
93
where
94
- S : AsRef < ffi:: OsStr >
94
+ S : AsRef < ffi:: OsStr > ,
95
95
{
96
- let temp = tempfile:: TempDir :: new ( )
97
- . chain ( FixtureError :: new ( FixtureKind :: CreateDir ) ) ?;
96
+ let temp = tempfile:: TempDir :: new ( ) . chain ( FixtureError :: new ( FixtureKind :: CreateDir ) ) ?;
98
97
let path = temp. path ( ) . join ( name. as_ref ( ) ) ;
99
98
let temp = Inner :: Temp ( temp) ;
100
99
Ok ( Self { temp, path } )
@@ -113,7 +112,7 @@ impl NamedTempFile {
113
112
/// tmp_file.close().unwrap();
114
113
/// ```
115
114
pub fn persist_if ( mut self , yes : bool ) -> Self {
116
- if ! yes {
115
+ if !yes {
117
116
return self ;
118
117
}
119
118
@@ -171,9 +170,9 @@ impl NamedTempFile {
171
170
/// ```
172
171
pub fn close ( self ) -> Result < ( ) , FixtureError > {
173
172
match self . temp {
174
- Inner :: Temp ( temp) =>
175
- temp . close ( )
176
- . chain ( FixtureError :: new ( FixtureKind :: Cleanup ) ) ?,
173
+ Inner :: Temp ( temp) => temp
174
+ . close ( )
175
+ . chain ( FixtureError :: new ( FixtureKind :: Cleanup ) ) ?,
177
176
Inner :: Persisted => ( ) ,
178
177
}
179
178
Ok ( ( ) )
Original file line number Diff line number Diff line change 1
1
//! Initialize the filesystem to use as test fixtures.
2
2
3
+ mod child;
3
4
mod dir;
4
- mod file;
5
5
mod errors;
6
+ mod file;
6
7
mod tools;
7
- mod child;
8
8
9
- pub use self :: errors:: * ;
10
- pub use self :: tools:: * ;
11
9
pub use self :: child:: * ;
12
10
pub use self :: dir:: * ;
11
+ pub use self :: errors:: * ;
13
12
pub use self :: file:: * ;
13
+ pub use self :: tools:: * ;
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ use globwalk;
9
9
10
10
use super :: errors:: * ;
11
11
use super :: ChildPath ;
12
- use super :: TempDir ;
13
12
use super :: NamedTempFile ;
13
+ use super :: TempDir ;
14
14
15
15
/// Create empty directories at [`ChildPath`].
16
16
///
Original file line number Diff line number Diff line change @@ -77,11 +77,11 @@ pub use fixture::TempDir;
77
77
/// Extension traits that are useful to have available.
78
78
pub mod prelude {
79
79
pub use assert:: PathAssert ;
80
- pub use fixture:: PathCreateDir ;
81
80
pub use fixture:: FileTouch ;
82
81
pub use fixture:: FileWriteBin ;
83
82
pub use fixture:: FileWriteFile ;
84
83
pub use fixture:: FileWriteStr ;
85
84
pub use fixture:: PathChild ;
86
85
pub use fixture:: PathCopy ;
86
+ pub use fixture:: PathCreateDir ;
87
87
}
You can’t perform that action at this time.
0 commit comments