Skip to content

Commit

Permalink
chore: small formatting changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
JosiahBull committed Dec 6, 2024
1 parent 3046658 commit 38453a9
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 18 deletions.
14 changes: 4 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions typify-impl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ syn = { version = "2.0.90", features = ["full"] }
thiserror = "2.0.3"
unicode-ident = "1.0.14"


[dev-dependencies]
env_logger = "0.10.2"
expectorate = "1.1.0"
Expand Down
2 changes: 1 addition & 1 deletion typify-impl/src/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ fn all_props<'a>(

// TODO Rather than an option, this should probably be something
// that lets us say "explicit name" or "type to validate against"
TypeEntryDetails::Map(value_id, _) => return vec![(None, value_id, false)],
TypeEntryDetails::Map(_, value_id) => return vec![(None, value_id, false)],
_ => unreachable!(),
};

Expand Down
6 changes: 2 additions & 4 deletions typify-impl/src/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ fn has_default(
// No default specified.
(Some(TypeEntryDetails::Option(_)), None) => StructPropertyState::Optional,
(Some(TypeEntryDetails::Vec(_)), None) => StructPropertyState::Optional,
(Some(TypeEntryDetails::Map { .. }), None) => StructPropertyState::Optional,
(Some(TypeEntryDetails::Map(_, _)), None) => StructPropertyState::Optional,
(Some(TypeEntryDetails::Unit), None) => StructPropertyState::Optional,
(_, None) => StructPropertyState::Required,

Expand All @@ -473,9 +473,7 @@ fn has_default(
StructPropertyState::Optional
}
// Default specified is the same as the implicit default: {}
(Some(TypeEntryDetails::Map { .. }), Some(serde_json::Value::Object(m)))
if m.is_empty() =>
{
(Some(TypeEntryDetails::Map(_, _)), Some(serde_json::Value::Object(m))) if m.is_empty() => {
StructPropertyState::Optional
}
// Default specified is the same as the implicit default: false
Expand Down
4 changes: 2 additions & 2 deletions typify-impl/src/type_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ impl TypeEntry {
TypeEntryDetails::Unit
| TypeEntryDetails::Option(_)
| TypeEntryDetails::Vec(_)
| TypeEntryDetails::Map { .. }
| TypeEntryDetails::Map(_, _)
| TypeEntryDetails::Set(_) => {
matches!(impl_name, TypeSpaceImpl::Default)
}
Expand Down Expand Up @@ -1750,7 +1750,7 @@ impl TypeEntry {
| TypeEntryDetails::Struct(_)
| TypeEntryDetails::Newtype(_)
| TypeEntryDetails::Vec(_)
| TypeEntryDetails::Map { .. }
| TypeEntryDetails::Map(_, _)
| TypeEntryDetails::Set(_)
| TypeEntryDetails::Box(_)
| TypeEntryDetails::Native(_)
Expand Down
2 changes: 1 addition & 1 deletion typify-impl/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ fn value_for_struct_props(
match &type_entry.details {
TypeEntryDetails::Struct(_)
| TypeEntryDetails::Option(_)
| TypeEntryDetails::Map { .. } => (),
| TypeEntryDetails::Map(_, _) => (),
_ => unreachable!(),
}

Expand Down

0 comments on commit 38453a9

Please sign in to comment.