Skip to content

Commit

Permalink
remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtbuilds committed Apr 12, 2024
1 parent e18380f commit 6c21d84
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 175 deletions.
137 changes: 0 additions & 137 deletions core/src/child_schemas.rs

This file was deleted.

29 changes: 0 additions & 29 deletions core/src/extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,35 +85,6 @@ pub fn validate(spec: &HirSpec) {
}
}

// pub fn deanonymize_array_items(spec: &mut HirSpec, openapi: &OpenAPI) {
// let current_schemas = spec
// .schemas
// .iter()
// .map(|(name, _)| name.clone())
// .collect::<HashSet<_>>();
// let mut new_schemas = vec![];
// for (name, schema) in spec.schemas.iter_mut() {
// let Record::Struct(s) = schema else {
// continue;
// };
// for (field, schema) in s.fields.iter_mut() {
// let Ty::Array(item) = &mut schema.ty else {
// continue;
// };
// let Ty::Any(Some(inner)) = item.as_mut() else {
// continue;
// };
// let Some(name) = create_unique_name(&current_schemas, name, field) else {
// continue;
// };
// let record = create_record(&name, inner, openapi);
// *item = Box::new(Ty::model(&name));
// new_schemas.push((name, record));
// }
// }
// spec.schemas.extend(new_schemas);
// }

pub fn is_optional(name: &str, param: &Schema, parent: &Schema) -> bool {
if param.nullable {
return true;
Expand Down
1 change: 0 additions & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pub use fs::*;
pub use options::*;
pub use template::*;

pub mod child_schemas;
pub mod extractor;
pub mod fs;
mod options;
Expand Down
2 changes: 0 additions & 2 deletions core/tests/test_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ fn test_post_translate() {
};
let z = &s.fields["translations"];
let Ty::Array(ty) = &z.ty else {
// eprintln!("{:?}", s);
// eprintln!("{:?}", hir.get_record("Translation"));
panic!("Expected array: {:?}", z.ty);
};
dbg!(&hir);
Expand Down
1 change: 0 additions & 1 deletion libninja/src/rust/codegen/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ pub fn to_rust_example_value(
docs: _docs,
}) => {
let variant = variants.first().unwrap();
eprintln!("variant: {}", variant);
let variant = variant.to_rust_struct();
let model = model.to_rust_struct();
quote!(#model::#variant)
Expand Down
5 changes: 0 additions & 5 deletions libninja/src/rust/lower_hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,10 @@ pub fn create_sumtype_struct(
}
}

// pub fn is_restricted(s: &str) -> bool {
// ["self"].contains(&s)
// }

fn create_enum_struct(e: &StrEnum, derives: &Vec<String>) -> TokenStream {
let enums = e.variants.iter().filter(|s| !s.is_empty()).map(|s| {
let original_name = s.to_string();
let mut s = original_name.clone();
eprintln!("enum variant: {}", s);
if !s.is_empty() && s.chars().next().unwrap().is_numeric() {
s = format!("{}{}", e.name, s);
}
Expand Down

0 comments on commit 6c21d84

Please sign in to comment.