@@ -6,9 +6,7 @@ use std::path;
6
6
use globwalk;
7
7
use tempfile;
8
8
9
- use errors;
10
- use errors:: ResultChainExt ;
11
-
9
+ pub use errors:: * ;
12
10
pub use tempfile:: TempDir ;
13
11
14
12
/// Access paths within [`TempDir`] for testing.
@@ -196,14 +194,14 @@ pub trait PathCopy {
196
194
/// temp.copy_from(".", &["*.rs"]).unwrap();
197
195
/// temp.close().unwrap();
198
196
/// ```
199
- fn copy_from < P , S > ( & self , source : P , patterns : & [ S ] ) -> Result < ( ) , errors :: FixtureError >
197
+ fn copy_from < P , S > ( & self , source : P , patterns : & [ S ] ) -> Result < ( ) , FixtureError >
200
198
where
201
199
P : AsRef < path:: Path > ,
202
200
S : AsRef < str > ;
203
201
}
204
202
205
203
impl PathCopy for tempfile:: TempDir {
206
- fn copy_from < P , S > ( & self , source : P , patterns : & [ S ] ) -> Result < ( ) , errors :: FixtureError >
204
+ fn copy_from < P , S > ( & self , source : P , patterns : & [ S ] ) -> Result < ( ) , FixtureError >
207
205
where
208
206
P : AsRef < path:: Path > ,
209
207
S : AsRef < str > ,
@@ -213,7 +211,7 @@ impl PathCopy for tempfile::TempDir {
213
211
}
214
212
215
213
impl PathCopy for ChildPath {
216
- fn copy_from < P , S > ( & self , source : P , patterns : & [ S ] ) -> Result < ( ) , errors :: FixtureError >
214
+ fn copy_from < P , S > ( & self , source : P , patterns : & [ S ] ) -> Result < ( ) , FixtureError >
217
215
where
218
216
P : AsRef < path:: Path > ,
219
217
S : AsRef < str > ,
@@ -241,34 +239,34 @@ fn copy_files<S>(
241
239
target : & path:: Path ,
242
240
source : & path:: Path ,
243
241
patterns : & [ S ] ,
244
- ) -> Result < ( ) , errors :: FixtureError >
242
+ ) -> Result < ( ) , FixtureError >
245
243
where
246
244
S : AsRef < str > ,
247
245
{
248
246
// `walkdir`, on Windows, seems to convert "." into "" which then fails.
249
247
let source = source
250
248
. canonicalize ( )
251
- . chain ( errors :: FixtureError :: new ( errors :: FixtureKind :: Walk ) ) ?;
249
+ . chain ( FixtureError :: new ( FixtureKind :: Walk ) ) ?;
252
250
for entry in globwalk:: GlobWalkerBuilder :: from_patterns ( & source, patterns)
253
251
. follow_links ( true )
254
252
. build ( )
255
- . chain ( errors :: FixtureError :: new ( errors :: FixtureKind :: Walk ) ) ?
253
+ . chain ( FixtureError :: new ( FixtureKind :: Walk ) ) ?
256
254
{
257
255
println ! ( "{:?}" , entry) ;
258
- let entry = entry. chain ( errors :: FixtureError :: new ( errors :: FixtureKind :: Walk ) ) ?;
256
+ let entry = entry. chain ( FixtureError :: new ( FixtureKind :: Walk ) ) ?;
259
257
let rel = entry
260
258
. path ( )
261
259
. strip_prefix ( & source)
262
260
. expect ( "entries to be under `source`" ) ;
263
261
let target_path = target. join ( rel) ;
264
262
if entry. file_type ( ) . is_dir ( ) {
265
263
fs:: create_dir_all ( target_path)
266
- . chain ( errors :: FixtureError :: new ( errors :: FixtureKind :: CreateDir ) ) ?;
264
+ . chain ( FixtureError :: new ( FixtureKind :: CreateDir ) ) ?;
267
265
} else if entry. file_type ( ) . is_file ( ) {
268
266
fs:: create_dir_all ( target_path. parent ( ) . expect ( "at least `target` exists" ) )
269
- . chain ( errors :: FixtureError :: new ( errors :: FixtureKind :: CreateDir ) ) ?;
267
+ . chain ( FixtureError :: new ( FixtureKind :: CreateDir ) ) ?;
270
268
fs:: copy ( entry. path ( ) , target_path)
271
- . chain ( errors :: FixtureError :: new ( errors :: FixtureKind :: CopyFile ) ) ?;
269
+ . chain ( FixtureError :: new ( FixtureKind :: CopyFile ) ) ?;
272
270
}
273
271
}
274
272
Ok ( ( ) )
0 commit comments