Skip to content

Commit 20a8cf6

Browse files
committed
Remove unused derives and dead functions in schemars code
1 parent efe145b commit 20a8cf6

File tree

3 files changed

+3
-24
lines changed

3 files changed

+3
-24
lines changed

serde_with/src/schemars_0_8.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,20 +1059,13 @@ mod timespan {
10591059
// #[non_exhaustive] is not actually necessary here but it should
10601060
// help avoid warnings about semver breakage if this ever changes.
10611061
#[non_exhaustive]
1062-
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
10631062
pub enum TimespanTargetType {
10641063
String,
10651064
F64,
10661065
U64,
10671066
I64,
10681067
}
10691068

1070-
impl TimespanTargetType {
1071-
pub const fn is_signed(self) -> bool {
1072-
!matches!(self, Self::U64)
1073-
}
1074-
}
1075-
10761069
/// Internal helper trait used to constrain which types we implement
10771070
/// `JsonSchemaAs<T>` for.
10781071
pub trait TimespanSchemaTarget<F> {
@@ -1194,7 +1187,7 @@ impl TimespanTargetType {
11941187
..Default::default()
11951188
};
11961189

1197-
if self == Self::String {
1190+
if matches!(self, Self::String) {
11981191
number.metadata().write_only = true;
11991192
} else {
12001193
string.metadata().write_only = true;

serde_with/src/schemars_0_9.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,20 +1061,13 @@ mod timespan {
10611061
// #[non_exhaustive] is not actually necessary here but it should
10621062
// help avoid warnings about semver breakage if this ever changes.
10631063
#[non_exhaustive]
1064-
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
10651064
pub enum TimespanTargetType {
10661065
String,
10671066
F64,
10681067
U64,
10691068
I64,
10701069
}
10711070

1072-
impl TimespanTargetType {
1073-
pub const fn is_signed(self) -> bool {
1074-
!matches!(self, Self::U64)
1075-
}
1076-
}
1077-
10781071
/// Internal helper trait used to constrain which types we implement
10791072
/// `JsonSchemaAs<T>` for.
10801073
pub trait TimespanSchemaTarget<F> {
@@ -1192,7 +1185,7 @@ impl TimespanTargetType {
11921185
}
11931186
});
11941187

1195-
if self == Self::String {
1188+
if matches!(self, Self::String) {
11961189
number
11971190
.ensure_object()
11981191
.insert("writeOnly".into(), true.into());

serde_with/src/schemars_1.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,20 +1068,13 @@ mod timespan {
10681068
// #[non_exhaustive] is not actually necessary here but it should
10691069
// help avoid warnings about semver breakage if this ever changes.
10701070
#[non_exhaustive]
1071-
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
10721071
pub enum TimespanTargetType {
10731072
String,
10741073
F64,
10751074
U64,
10761075
I64,
10771076
}
10781077

1079-
impl TimespanTargetType {
1080-
pub const fn is_signed(self) -> bool {
1081-
!matches!(self, Self::U64)
1082-
}
1083-
}
1084-
10851078
/// Internal helper trait used to constrain which types we implement
10861079
/// `JsonSchemaAs<T>` for.
10871080
pub trait TimespanSchemaTarget<F> {
@@ -1199,7 +1192,7 @@ impl TimespanTargetType {
11991192
}
12001193
});
12011194

1202-
if self == Self::String {
1195+
if matches!(self, Self::String) {
12031196
number
12041197
.ensure_object()
12051198
.insert("writeOnly".into(), true.into());

0 commit comments

Comments
 (0)