Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 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 tasks/ast_tools/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ doctest = false
[dependencies]
bpaf = { workspace = true, features = ["autocomplete", "bright-color", "derive"] }
convert_case = { workspace = true }
cow-utils = { workspace = true }
itertools = { workspace = true }
lazy_static = { workspace = true }
prettyplease = { workspace = true }
Expand Down
2 changes: 0 additions & 2 deletions tasks/ast_tools/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::disallowed_methods)]

use std::{cell::RefCell, io::Read, path::PathBuf, rc::Rc};

use bpaf::{Bpaf, Parser};
Expand Down
3 changes: 2 additions & 1 deletion tasks/ast_tools/src/output/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::{
path::Path,
};

use cow_utils::CowUtils;
use proc_macro2::TokenStream;

use crate::{log, log_result};
Expand Down Expand Up @@ -32,7 +33,7 @@ pub enum Output {

impl Output {
pub fn into_raw(self, generator_path: &str) -> RawOutput {
let generator_path = generator_path.replace('\\', "/");
let generator_path = generator_path.cow_replace('\\', "/");

let (path, code) = match self {
Self::Rust { path, tokens } => {
Expand Down
11 changes: 4 additions & 7 deletions tasks/ast_tools/src/passes/calc_layout.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::cmp::max;

use cow_utils::CowUtils;
use itertools::Itertools;
use lazy_static::lazy_static;
use quote::ToTokens;
Expand Down Expand Up @@ -223,14 +224,10 @@ fn calc_type_layout(ty: &TypeAnalysis, ctx: &EarlyCtx) -> Result<PlatformLayout>
panic!();
};

let typ = typ
.path
.segments
.first()
.map(|it| it.to_token_stream().to_string().replace(' ', ""))
.expect("We only accept single segment types.");
let typ = typ.path.segments.first().unwrap().to_token_stream().to_string();
let typ = &*typ.cow_replace(' ', "");

if let Some(typ) = WELL_KNOWN.get(typ.as_str()) {
if let Some(typ) = WELL_KNOWN.get(typ) {
typ.clone()
} else {
panic!("Unsupported type: {:#?}", ty.typ.to_token_stream().to_string())
Expand Down
1 change: 1 addition & 0 deletions tasks/ast_tools/src/schema/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ fn create_type_ref(ty: &Type, ctx: &EarlyCtx) -> TypeRef {
let ident = ty.get_ident();
let id = ident.as_ident().and_then(|id| ctx.type_id(&id.to_string()));
let transparent_id = ctx.type_id(&ident.inner_ident().to_string());
#[expect(clippy::disallowed_methods)]
let raw = ty.to_token_stream().to_string().replace(' ', "");
TypeRef {
id,
Expand Down