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 f836f36
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 20 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
4 changes: 2 additions & 2 deletions typify-impl/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl TypeEntry {
.collect::<Option<Vec<_>>>()?;
quote! { vec![#(#values),*] }
}
TypeEntryDetails::Map(key_id, value_id, ..) => {
TypeEntryDetails::Map(key_id, value_id) => {
let obj = value.as_object()?;
let key_ty = type_space.id_to_entry.get(key_id).unwrap();
let value_ty = type_space.id_to_entry.get(value_id).unwrap();
Expand Down 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
2 changes: 1 addition & 1 deletion typify-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ prettyplease = "0.2.25"
schemars = "0.8.21"
serde = "1.0.215"
syn = "2.0.90"
typify = { path = "../typify"}
typify = { path = "../typify" }

0 comments on commit f836f36

Please sign in to comment.