Skip to content

Commit aea3d4a

Browse files
committed
address some pedantic lints
1 parent 41d7439 commit aea3d4a

File tree

4 files changed

+36
-35
lines changed

4 files changed

+36
-35
lines changed

typify-impl/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,17 +154,17 @@ pub(crate) enum Name {
154154
impl Name {
155155
pub fn into_option(self) -> Option<String> {
156156
match self {
157-
Name::Required(s) | Name::Suggested(s) => Some(s),
158-
Name::Unknown => None,
157+
Self::Required(s) | Self::Suggested(s) => Some(s),
158+
Self::Unknown => None,
159159
}
160160
}
161161

162162
pub fn append(&self, s: &str) -> Self {
163163
match self {
164-
Name::Required(prefix) | Name::Suggested(prefix) => {
164+
Self::Required(prefix) | Self::Suggested(prefix) => {
165165
Self::Suggested(format!("{prefix}_{s}"))
166166
}
167-
Name::Unknown => Name::Unknown,
167+
Self::Unknown => Self::Unknown,
168168
}
169169
}
170170
}

typify-impl/src/merge.rs

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,29 +1126,30 @@ trait Roughly {
11261126
impl Roughly for schemars::schema::Schema {
11271127
fn roughly(&self, other: &Self) -> bool {
11281128
match (self, other) {
1129-
(Schema::Bool(a), Schema::Bool(b)) => a == b,
1130-
(Schema::Bool(false), _) | (_, Schema::Bool(false)) => false,
1131-
1132-
(Schema::Bool(true), Schema::Object(other))
1133-
| (Schema::Object(other), Schema::Bool(true)) => matches!(
1134-
other,
1135-
SchemaObject {
1136-
metadata: _,
1137-
instance_type: None,
1138-
format: None,
1139-
enum_values: None,
1140-
const_value: None,
1141-
subschemas: None,
1142-
number: None,
1143-
string: None,
1144-
array: None,
1145-
object: None,
1146-
reference: None,
1147-
extensions: _,
1148-
}
1149-
),
1129+
(Self::Bool(a), Self::Bool(b)) => a == b,
1130+
(Self::Bool(false), _) | (_, Self::Bool(false)) => false,
1131+
1132+
(Self::Bool(true), Self::Object(other)) | (Self::Object(other), Self::Bool(true)) => {
1133+
matches!(
1134+
other,
1135+
SchemaObject {
1136+
metadata: _,
1137+
instance_type: None,
1138+
format: None,
1139+
enum_values: None,
1140+
const_value: None,
1141+
subschemas: None,
1142+
number: None,
1143+
string: None,
1144+
array: None,
1145+
object: None,
1146+
reference: None,
1147+
extensions: _,
1148+
}
1149+
)
1150+
}
11501151

1151-
(Schema::Object(a), Schema::Object(b)) => {
1152+
(Self::Object(a), Self::Object(b)) => {
11521153
a.instance_type == b.instance_type
11531154
&& a.format == b.format
11541155
&& a.enum_values == b.enum_values

typify-impl/src/test_util.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,9 @@ impl SynCompare for Variant {
282282
impl SynCompare for Fields {
283283
fn syn_cmp(&self, other: &Self, _: bool) -> Result<(), String> {
284284
match (self, other) {
285-
(Fields::Named(a), Fields::Named(b)) => a.syn_cmp(b, false),
286-
(Fields::Unnamed(a), Fields::Unnamed(b)) => a.syn_cmp(b, false),
287-
(Fields::Unit, Fields::Unit) => Ok(()),
285+
(Self::Named(a), Self::Named(b)) => a.syn_cmp(b, false),
286+
(Self::Unnamed(a), Self::Unnamed(b)) => a.syn_cmp(b, false),
287+
(Self::Unit, Self::Unit) => Ok(()),
288288
_ => Err("mismatched field types".to_string()),
289289
}
290290
}
@@ -313,8 +313,8 @@ impl SynCompare for Field {
313313
impl SynCompare for Type {
314314
fn syn_cmp(&self, other: &Self, _: bool) -> Result<(), String> {
315315
match (self, other) {
316-
(Type::Tuple(a), Type::Tuple(b)) => a.syn_cmp(b, false),
317-
(Type::Path(a), Type::Path(b)) => a.syn_cmp(b, false),
316+
(Self::Tuple(a), Self::Tuple(b)) => a.syn_cmp(b, false),
317+
(Self::Path(a), Self::Path(b)) => a.syn_cmp(b, false),
318318
_ => Err(format!(
319319
"unexpected or mismatched type pair: {self:?} {other:?}"
320320
)),

typify-impl/src/type_entry.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ impl From<TypeEntryDetails> for TypeEntry {
546546

547547
impl TypeEntry {
548548
pub(crate) fn new_native<S: ToString>(type_name: S, impls: &[TypeSpaceImpl]) -> Self {
549-
TypeEntry {
549+
Self {
550550
details: TypeEntryDetails::Native(TypeEntryNative {
551551
type_name: type_name.to_string(),
552552
impls: impls.to_vec(),
@@ -556,7 +556,7 @@ impl TypeEntry {
556556
}
557557
}
558558
pub(crate) fn new_native_params<S: ToString>(type_name: S, params: &[TypeId]) -> Self {
559-
TypeEntry {
559+
Self {
560560
details: TypeEntryDetails::Native(TypeEntryNative {
561561
type_name: type_name.to_string(),
562562
impls: Default::default(),
@@ -566,7 +566,7 @@ impl TypeEntry {
566566
}
567567
}
568568
pub(crate) fn new_boolean() -> Self {
569-
TypeEntry {
569+
Self {
570570
details: TypeEntryDetails::Boolean,
571571
extra_derives: Default::default(),
572572
}
@@ -575,7 +575,7 @@ impl TypeEntry {
575575
TypeEntryDetails::Integer(type_name.to_string()).into()
576576
}
577577
pub(crate) fn new_float<S: ToString>(type_name: S) -> Self {
578-
TypeEntry {
578+
Self {
579579
details: TypeEntryDetails::Float(type_name.to_string()),
580580
extra_derives: Default::default(),
581581
}

0 commit comments

Comments
 (0)