Skip to content

Commit

Permalink
Minor tidy up of the code
Browse files Browse the repository at this point in the history
Remove some `dbg!` that I left in by accident.  Revert a couple of
unintnetional changes to the indentation of the JSON in the test.
  • Loading branch information
anelson committed Nov 30, 2024
1 parent e6be446 commit 644e688
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
10 changes: 1 addition & 9 deletions typify-impl/src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,9 @@ fn decanonicalize_std_types(mut input: DeriveInput) -> DeriveInput {

impl syn::visit_mut::VisitMut for Visitor {
fn visit_path_mut(&mut self, path: &mut syn::Path) {
dbg!("Before", path.to_token_stream().to_string());

// Check if path starts with ::std
if path.leading_colon.is_some()
&& path.segments.len() >= 1
&& !path.segments.is_empty()
&& path.segments[0].ident == "std"
{
// Fun additional hack to keep you on your toes:
Expand All @@ -135,19 +133,13 @@ fn decanonicalize_std_types(mut input: DeriveInput) -> DeriveInput {
}
}

dbg!("After", path.to_token_stream().to_string());

// Delegate to the default impl to visit nested paths
syn::visit_mut::visit_path_mut(self, path);
}
}

dbg!("Canonicalized: ", input.to_token_stream().to_string());
let mut visitor = Visitor;
syn::visit_mut::visit_derive_input_mut(&mut visitor, &mut input);

dbg!("Decanonialized: ", input.to_token_stream().to_string());

input
}

Expand Down
12 changes: 6 additions & 6 deletions typify-impl/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,9 @@ mod tests {
&type_space,
&json!(
{
"a": "aaaa",
"b": 7,
"c": "cccc"
"a": "aaaa",
"b": 7,
"c": "cccc"
}
),
&quote! {super::}
Expand Down Expand Up @@ -662,9 +662,9 @@ mod tests {
&type_space,
&json!(
{
"a": "aaaa",
"b": 7,
"c": "cccc"
"a": "aaaa",
"b": 7,
"c": "cccc"
}
),
&quote! {}
Expand Down

0 comments on commit 644e688

Please sign in to comment.