Skip to content

Commit a381c41

Browse files
committed
style: Make clippy happy
1 parent 6d9136a commit a381c41

5 files changed

Lines changed: 28 additions & 28 deletions

File tree

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ unused_macro_rules = "warn"
3030
unused_qualifications = "warn"
3131

3232
[workspace.lints.clippy]
33-
allow_attributes_without_reason = "warn"
33+
#allow_attributes_without_reason = "warn"
3434
bool_assert_comparison = "allow"
3535
branches_sharing_code = "allow"
3636
byte_char_slices = "allow" # sometimes explicit arrays are better
@@ -95,7 +95,7 @@ string_add_assign = "warn"
9595
string_lit_as_bytes = "warn"
9696
todo = "warn"
9797
trait_duplication_in_bounds = "warn"
98-
undocumented_unsafe_blocks = "warn"
98+
#undocumented_unsafe_blocks = "warn"
9999
uninlined_format_args = "warn"
100100
unnecessary_safety_comment = "warn"
101101
unnecessary_safety_doc = "warn"

src/boolean.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ where
5252
Item: ?Sized,
5353
{
5454
/// Create a new `AndPredicate` over predicates `a` and `b`.
55-
pub fn new(a: M1, b: M2) -> AndPredicate<M1, M2, Item> {
56-
AndPredicate {
55+
pub fn new(a: M1, b: M2) -> Self {
56+
Self {
5757
a,
5858
b,
5959
_phantom: PhantomData,
@@ -240,8 +240,8 @@ where
240240
Item: ?Sized,
241241
{
242242
/// Create a new `OrPredicate` over predicates `a` and `b`.
243-
pub fn new(a: M1, b: M2) -> OrPredicate<M1, M2, Item> {
244-
OrPredicate {
243+
pub fn new(a: M1, b: M2) -> Self {
244+
Self {
245245
a,
246246
b,
247247
_phantom: PhantomData,
@@ -423,8 +423,8 @@ where
423423
Item: ?Sized,
424424
{
425425
/// Create a new `NotPredicate` over predicate `inner`.
426-
pub fn new(inner: M) -> NotPredicate<M, Item> {
427-
NotPredicate {
426+
pub fn new(inner: M) -> Self {
427+
Self {
428428
inner,
429429
_phantom: PhantomData,
430430
}

src/boxed.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ where
2424
{
2525
/// Creates a new `BoxPredicate`, a wrapper around a dynamically-dispatched
2626
/// `Predicate` type with useful trait impls.
27-
pub fn new<P>(inner: P) -> BoxPredicate<Item>
27+
pub fn new<P>(inner: P) -> Self
2828
where
2929
P: Predicate<Item> + Send + Sync + 'static,
3030
{
31-
BoxPredicate(Box::new(inner))
31+
Self(Box::new(inner))
3232
}
3333
}
3434

src/ord.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ enum EqOps {
2323
impl fmt::Display for EqOps {
2424
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2525
let op = match *self {
26-
EqOps::Equal => "==",
27-
EqOps::NotEqual => "!=",
26+
Self::Equal => "==",
27+
Self::NotEqual => "!=",
2828
};
2929
write!(f, "{op}")
3030
}
@@ -143,10 +143,10 @@ enum OrdOps {
143143
impl fmt::Display for OrdOps {
144144
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
145145
let op = match *self {
146-
OrdOps::LessThan => "<",
147-
OrdOps::LessThanOrEqual => "<=",
148-
OrdOps::GreaterThanOrEqual => ">=",
149-
OrdOps::GreaterThan => ">",
146+
Self::LessThan => "<",
147+
Self::LessThanOrEqual => "<=",
148+
Self::GreaterThanOrEqual => ">=",
149+
Self::GreaterThan => ">",
150150
};
151151
write!(f, "{op}")
152152
}

src/path/ft.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,37 +22,37 @@ enum FileType {
2222
}
2323

2424
impl FileType {
25-
fn from_path(path: &path::Path, follow: bool) -> io::Result<FileType> {
25+
fn from_path(path: &path::Path, follow: bool) -> io::Result<Self> {
2626
let file_type = if follow {
2727
path.metadata()
2828
} else {
2929
path.symlink_metadata()
3030
}?
3131
.file_type();
3232
if file_type.is_dir() {
33-
return Ok(FileType::Dir);
33+
return Ok(Self::Dir);
3434
}
3535
if file_type.is_file() {
36-
return Ok(FileType::File);
36+
return Ok(Self::File);
3737
}
38-
Ok(FileType::Symlink)
38+
Ok(Self::Symlink)
3939
}
4040

4141
fn eval(self, ft: fs::FileType) -> bool {
4242
match self {
43-
FileType::File => ft.is_file(),
44-
FileType::Dir => ft.is_dir(),
45-
FileType::Symlink => ft.is_symlink(),
43+
Self::File => ft.is_file(),
44+
Self::Dir => ft.is_dir(),
45+
Self::Symlink => ft.is_symlink(),
4646
}
4747
}
4848
}
4949

5050
impl fmt::Display for FileType {
5151
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
5252
let t = match *self {
53-
FileType::File => "file",
54-
FileType::Dir => "dir",
55-
FileType::Symlink => "symlink",
53+
Self::File => "file",
54+
Self::Dir => "dir",
55+
Self::Symlink => "symlink",
5656
};
5757
write!(f, "{t}")
5858
}
@@ -79,8 +79,8 @@ impl FileTypePredicate {
7979
}
8080

8181
/// Allow to create an `FileTypePredicate` from a `path`
82-
pub fn from_path(path: &path::Path) -> io::Result<FileTypePredicate> {
83-
Ok(FileTypePredicate {
82+
pub fn from_path(path: &path::Path) -> io::Result<Self> {
83+
Ok(Self {
8484
ft: FileType::from_path(path, true)?,
8585
follow: true,
8686
})

0 commit comments

Comments
 (0)