Skip to content

Commit b2ba44f

Browse files
authored
remove some dead code that displeases more recent rust versions (#826)
1 parent 91854a7 commit b2ba44f

3 files changed

Lines changed: 4 additions & 46 deletions

File tree

typify-impl/src/convert.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,8 +2067,7 @@ mod tests {
20672067
use serde_json::json;
20682068

20692069
use crate::{
2070-
test_util::validate_output, validate_builtin, Error, Name, TypeSpace, TypeSpaceImpl,
2071-
TypeSpaceSettings,
2070+
test_util::validate_output, Error, Name, TypeSpace, TypeSpaceImpl, TypeSpaceSettings,
20722071
};
20732072

20742073
#[track_caller]
@@ -2177,13 +2176,6 @@ mod tests {
21772176
validate_output::<Bar>();
21782177
}
21792178

2180-
// TODO we can turn this on once we generate proper sets.
2181-
#[ignore]
2182-
#[test]
2183-
fn test_set() {
2184-
validate_builtin!(std::collections::BTreeSet<u32>);
2185-
}
2186-
21872179
#[test]
21882180
fn test_low_default() {
21892181
let schema = SchemaObject {

typify-impl/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ impl<'a> TypeStruct<'a> {
11761176
}
11771177

11781178
/// Get all information about each struct property.
1179-
pub fn properties_info(&'a self) -> impl Iterator<Item = TypeStructPropInfo> {
1179+
pub fn properties_info(&'a self) -> impl Iterator<Item = TypeStructPropInfo<'a>> {
11801180
self.details
11811181
.properties
11821182
.iter()

typify-impl/src/test_util.rs

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 Oxide Computer Company
1+
// Copyright 2025 Oxide Computer Company
22

33
use std::{any::type_name, collections::HashSet};
44

@@ -12,7 +12,7 @@ use syn::{
1212
FieldsNamed, FieldsUnnamed, File, Type, TypePath, TypeTuple, Variant,
1313
};
1414

15-
use crate::{output::OutputSpace, Name, RefKey, TypeId, TypeSpace};
15+
use crate::{output::OutputSpace, RefKey, TypeId, TypeSpace};
1616

1717
pub(crate) fn get_type<T: JsonSchema>() -> (TypeSpace, TypeId) {
1818
let schema = schema_for!(T);
@@ -141,40 +141,6 @@ fn decanonicalize_std_types(mut input: DeriveInput) -> DeriveInput {
141141
input
142142
}
143143

144-
#[macro_export]
145-
macro_rules! validate_builtin {
146-
($t:ty) => {
147-
$crate::test_util::validate_builtin_impl::<$t>(stringify!($t))
148-
};
149-
}
150-
151-
#[track_caller]
152-
pub(crate) fn validate_builtin_impl<T: JsonSchema>(name: &str) {
153-
let schema = schema_for!(T);
154-
let original_schema = schemars::schema::Schema::Object(schema.schema.clone());
155-
156-
let mut type_space = TypeSpace::default();
157-
type_space
158-
.add_ref_types(schema.definitions.clone())
159-
.unwrap();
160-
let (ty, _) = type_space
161-
.convert_schema_object(Name::Unknown, &original_schema, &schema.schema)
162-
.unwrap();
163-
164-
let output = ty.type_ident(&type_space, &None);
165-
166-
let actual = syn::parse2::<syn::Type>(output.clone()).unwrap();
167-
let expected = syn::parse_str::<syn::Type>(name).unwrap();
168-
169-
// Make sure they match.
170-
if let Err(err) = expected.syn_cmp(&actual, false) {
171-
println!("{:#?}", schema);
172-
println!("actual: {}", output);
173-
println!("expected: {}", name);
174-
panic!("{}", err);
175-
}
176-
}
177-
178144
pub(crate) trait SynCompare {
179145
fn syn_cmp(&self, other: &Self, ignore_variant_names: bool) -> Result<(), String>;
180146
}

0 commit comments

Comments
 (0)