First pass on fixes

This commit is contained in:
Piotr Osiewicz 2025-08-19 14:23:59 +02:00
parent 5826d89b97
commit 2f3be75fc7
269 changed files with 1593 additions and 2574 deletions

View file

@ -160,17 +160,14 @@ fn extract_doc_comment(attrs: &[Attribute]) -> Option<String> {
let mut doc_lines = Vec::new();
for attr in attrs {
if attr.path().is_ident("doc") {
if let Meta::NameValue(meta) = &attr.meta {
if let Expr::Lit(expr_lit) = &meta.value {
if let Lit::Str(lit_str) = &expr_lit.lit {
if attr.path().is_ident("doc")
&& let Meta::NameValue(meta) = &attr.meta
&& let Expr::Lit(expr_lit) = &meta.value
&& let Lit::Str(lit_str) = &expr_lit.lit {
let line = lit_str.value();
let line = line.strip_prefix(' ').unwrap_or(&line);
doc_lines.push(line.to_string());
}
}
}
}
}
if doc_lines.is_empty() {

View file

@ -152,8 +152,8 @@ fn generate_test_function(
}
_ => {}
}
} else if let Type::Reference(ty) = &*arg.ty {
if let Type::Path(ty) = &*ty.elem {
} else if let Type::Reference(ty) = &*arg.ty
&& let Type::Path(ty) = &*ty.elem {
let last_segment = ty.path.segments.last();
if let Some("TestAppContext") =
last_segment.map(|s| s.ident.to_string()).as_deref()
@ -175,7 +175,6 @@ fn generate_test_function(
continue;
}
}
}
}
return Err(error_with_message("invalid function signature", arg));
@ -215,8 +214,8 @@ fn generate_test_function(
inner_fn_args.extend(quote!(rand::SeedableRng::seed_from_u64(_seed),));
continue;
}
} else if let Type::Reference(ty) = &*arg.ty {
if let Type::Path(ty) = &*ty.elem {
} else if let Type::Reference(ty) = &*arg.ty
&& let Type::Path(ty) = &*ty.elem {
let last_segment = ty.path.segments.last();
match last_segment.map(|s| s.ident.to_string()).as_deref() {
Some("App") => {
@ -258,7 +257,6 @@ fn generate_test_function(
_ => {}
}
}
}
}
return Err(error_with_message("invalid function signature", arg));