Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tasks): cargo clippy error on rust 1.82.0 #7283

Merged
merged 2 commits into from
Nov 14, 2024
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
14 changes: 8 additions & 6 deletions tasks/ast_tools/src/generators/typescript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,19 @@ fn typescript_struct(def: &StructDef, always_flatten_structs: &FxHashSet<TypeId>

let ident = field.ident().unwrap();
if let Some(append_after) = append_to.get(&ident.to_string()) {
let after_type = match &append_after.markers.derive_attributes.estree.typescript_type {
Some(ty) => ty.clone(),
None => {
let after_type =
if let Some(ty) = &append_after.markers.derive_attributes.estree.typescript_type {
ty.clone()
} else {
let typ = append_after.typ.name();
if let TypeName::Opt(inner) = typ {
type_to_string(inner)
} else {
panic!("expected field labeled with append_to to be Option<...>, but found {typ}");
panic!(
"expected field labeled with append_to to be Option<...>, but found {typ}"
);
}
}
};
};
if let Some(inner) = ty.strip_prefix("Array<") {
ty = format!("Array<{after_type} | {inner}");
} else {
Expand Down
8 changes: 4 additions & 4 deletions tasks/ast_tools/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ impl Layout {
/// For `n` bigger than `16`, Or if it's not a power of 2 number
fn max_val_of_bytes(n: usize) -> u128 {
match n {
1 => u8::MAX as u128,
2 => u16::MAX as u128,
4 => u32::MAX as u128,
8 => u64::MAX as u128,
1 => u128::from(u8::MAX),
2 => u128::from(u16::MAX),
4 => u128::from(u32::MAX),
8 => u128::from(u64::MAX),
16 => u128::MAX,
_ => panic!("We do not support `n` bigger than 16 bytes."),
}
Expand Down
Loading