Skip to content

Commit 4caa847

Browse files
authored
Merge pull request #55 from epage/clean
style: Update to 2018 edition
2 parents 9414192 + 9956c64 commit 4caa847

File tree

5 files changed

+27
-33
lines changed

5 files changed

+27
-33
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ documentation = "http://docs.rs/assert_fs/"
1010
readme = "README.md"
1111
categories = ["development-tools::testing"]
1212
keywords = ["filesystem", "test", "assert", "fixture"]
13+
edition = "2018"
1314

1415
[dependencies]
1516
tempfile = "3.0"

src/assert.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use predicates::str::PredicateStrExt;
3434
use predicates_core;
3535
use predicates_tree::CaseTreeExt;
3636

37-
use fixture;
37+
use crate::fixture;
3838

3939
/// Assert the state of files within [`TempDir`].
4040
///
@@ -240,12 +240,12 @@ impl BytesContentPathPredicate {
240240
impl predicates_core::reflection::PredicateReflection for BytesContentPathPredicate {
241241
fn parameters<'a>(
242242
&'a self,
243-
) -> Box<Iterator<Item = predicates_core::reflection::Parameter<'a>> + 'a> {
243+
) -> Box<dyn Iterator<Item = predicates_core::reflection::Parameter<'a>> + 'a> {
244244
self.0.parameters()
245245
}
246246

247247
/// Nested `Predicate`s of the current `Predicate`.
248-
fn children<'a>(&'a self) -> Box<Iterator<Item = predicates_core::reflection::Child<'a>> + 'a> {
248+
fn children<'a>(&'a self) -> Box<dyn Iterator<Item = predicates_core::reflection::Child<'a>> + 'a> {
249249
self.0.children()
250250
}
251251
}
@@ -265,7 +265,7 @@ impl predicates_core::Predicate<path::Path> for BytesContentPathPredicate {
265265
}
266266

267267
impl fmt::Display for BytesContentPathPredicate {
268-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
268+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
269269
self.0.fmt(f)
270270
}
271271
}
@@ -316,12 +316,12 @@ impl StrContentPathPredicate {
316316
impl predicates_core::reflection::PredicateReflection for StrContentPathPredicate {
317317
fn parameters<'a>(
318318
&'a self,
319-
) -> Box<Iterator<Item = predicates_core::reflection::Parameter<'a>> + 'a> {
319+
) -> Box<dyn Iterator<Item = predicates_core::reflection::Parameter<'a>> + 'a> {
320320
self.0.parameters()
321321
}
322322

323323
/// Nested `Predicate`s of the current `Predicate`.
324-
fn children<'a>(&'a self) -> Box<Iterator<Item = predicates_core::reflection::Child<'a>> + 'a> {
324+
fn children<'a>(&'a self) -> Box<dyn Iterator<Item = predicates_core::reflection::Child<'a>> + 'a> {
325325
self.0.children()
326326
}
327327
}
@@ -341,7 +341,7 @@ impl predicates_core::Predicate<path::Path> for StrContentPathPredicate {
341341
}
342342

343343
impl fmt::Display for StrContentPathPredicate {
344-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
344+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
345345
self.0.fmt(f)
346346
}
347347
}
@@ -400,12 +400,12 @@ where
400400
{
401401
fn parameters<'a>(
402402
&'a self,
403-
) -> Box<Iterator<Item = predicates_core::reflection::Parameter<'a>> + 'a> {
403+
) -> Box<dyn Iterator<Item = predicates_core::reflection::Parameter<'a>> + 'a> {
404404
self.0.parameters()
405405
}
406406

407407
/// Nested `Predicate`s of the current `Predicate`.
408-
fn children<'a>(&'a self) -> Box<Iterator<Item = predicates_core::reflection::Child<'a>> + 'a> {
408+
fn children<'a>(&'a self) -> Box<dyn Iterator<Item = predicates_core::reflection::Child<'a>> + 'a> {
409409
self.0.children()
410410
}
411411
}
@@ -431,7 +431,7 @@ impl<P> fmt::Display for StrPathPredicate<P>
431431
where
432432
P: predicates_core::Predicate<str>,
433433
{
434-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
434+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
435435
self.0.fmt(f)
436436
}
437437
}

src/fixture/errors.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub enum FixtureKind {
5858
}
5959

6060
impl fmt::Display for FixtureKind {
61-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
61+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
6262
match *self {
6363
FixtureKind::Walk => write!(f, "Failed when walking the source tree,"),
6464
FixtureKind::CopyFile => write!(f, "Failed when copying a file."),
@@ -74,7 +74,7 @@ impl fmt::Display for FixtureKind {
7474
#[derive(Debug)]
7575
pub struct FixtureError {
7676
kind: FixtureKind,
77-
cause: Option<Box<Error + Send + Sync + 'static>>,
77+
cause: Option<Box<dyn Error + Send + Sync + 'static>>,
7878
}
7979

8080
impl FixtureError {
@@ -94,16 +94,16 @@ impl Error for FixtureError {
9494
"Failed to initialize fixture"
9595
}
9696

97-
fn cause(&self) -> Option<&Error> {
97+
fn cause(&self) -> Option<&dyn Error> {
9898
self.cause.as_ref().map(|c| {
99-
let c: &Error = c.as_ref();
99+
let c: &dyn Error = c.as_ref();
100100
c
101101
})
102102
}
103103
}
104104

105105
impl fmt::Display for FixtureError {
106-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
106+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
107107
match self.cause {
108108
Some(ref cause) => write!(
109109
f,

src/lib.rs

+10-16
Original file line numberDiff line numberDiff line change
@@ -64,33 +64,27 @@
6464
6565
#![warn(missing_docs)]
6666

67-
extern crate globwalk;
68-
extern crate predicates;
69-
extern crate predicates_core;
70-
extern crate predicates_tree;
71-
extern crate tempfile;
72-
7367
pub mod assert;
7468
pub mod fixture;
7569

7670
// Pulling this in for convenience-sake
7771
#[doc(inline)]
78-
pub use fixture::TempDir;
72+
pub use crate::fixture::TempDir;
7973

8074
// Pulling this in for convenience-sake
8175
#[doc(inline)]
82-
pub use fixture::NamedTempFile;
76+
pub use crate::fixture::NamedTempFile;
8377

8478
/// Extension traits that are useful to have available.
8579
pub mod prelude {
86-
pub use assert::PathAssert;
87-
pub use fixture::FileTouch;
88-
pub use fixture::FileWriteBin;
89-
pub use fixture::FileWriteFile;
90-
pub use fixture::FileWriteStr;
91-
pub use fixture::PathChild;
92-
pub use fixture::PathCopy;
93-
pub use fixture::PathCreateDir;
80+
pub use crate::assert::PathAssert;
81+
pub use crate::fixture::FileTouch;
82+
pub use crate::fixture::FileWriteBin;
83+
pub use crate::fixture::FileWriteFile;
84+
pub use crate::fixture::FileWriteStr;
85+
pub use crate::fixture::PathChild;
86+
pub use crate::fixture::PathCopy;
87+
pub use crate::fixture::PathCreateDir;
9488
}
9589

9690
#[macro_use]

tests/assert.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
extern crate assert_fs;
2-
extern crate predicates;
1+
use assert_fs;
32

43
use assert_fs::prelude::*;
54
use predicates::prelude::*;

0 commit comments

Comments
 (0)