Quiet the clippy type-complexity and closure lints on the record kernels

This commit is contained in:
Dennis Kobert
2026-08-24 11:07:14 +00:00
parent ed6922d7eb
commit d70eae205d
4 changed files with 29 additions and 22 deletions
+16 -18
View File
@@ -1611,7 +1611,7 @@ pub(crate) fn generate_node_impl(crate_ident: &CrateIdent, parsed: &ParsedNodeFn
}; };
let kernel = match async_fn { let kernel = match async_fn {
false => quote! { false => quote! {
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments, clippy::type_complexity)]
#vis fn #fn_name<#attr_lifetime #lane_lifetime #(#generics,)*>(#ctx_pat: &#ctx_ident #(, #data_params)* #(, #kernel_params)*) -> #kernel_output #fn_where #body #vis fn #fn_name<#attr_lifetime #lane_lifetime #(#generics,)*>(#ctx_pat: &#ctx_ident #(, #data_params)* #(, #kernel_params)*) -> #kernel_output #fn_where #body
}, },
true => { true => {
@@ -1636,7 +1636,7 @@ pub(crate) fn generate_node_impl(crate_ident: &CrateIdent, parsed: &ParsedNodeFn
}); });
let params = snapshot_param.chain(data_kernel_params).chain(value_kernel_params); let params = snapshot_param.chain(data_kernel_params).chain(value_kernel_params);
quote! { quote! {
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments, clippy::type_complexity)]
#vis async fn #fn_name<#(#kernel_generics,)*>(#(#params),*) -> #output_type #fn_where #body #vis async fn #fn_name<#(#kernel_generics,)*>(#(#params),*) -> #output_type #fn_where #body
} }
} }
@@ -1797,23 +1797,21 @@ pub(crate) fn generate_node_impl(crate_ident: &CrateIdent, parsed: &ParsedNodeFn
let carry = (!skips_carrier && !lazy_carrier).then(|| quote!(unsafe { #core_types::record::apply_plan(__src_rec, __dst, &self.__plan) };)); let carry = (!skips_carrier && !lazy_carrier).then(|| quote!(unsafe { #core_types::record::apply_plan(__src_rec, __dst, &self.__plan) };));
// A lazy carrier's source record is the token the kernel returned; its // A lazy carrier's source record is the token the kernel returned; its
// content frames sit above `__dst` and stay readable until the truncate. // content frames sit above `__dst` and stay readable until the truncate.
let lazy_carry = lazy_carrier let lazy_carry = match lazy_carrier {
.then(|| { true => quote! {
quote! { let __src_rec = self.__carrier.rec(&__element);
let __src_rec = self.__carrier.rec(&__element); unsafe { #core_types::record::apply_plan(__src_rec, __dst, &self.__plan) };
unsafe { #core_types::record::apply_plan(__src_rec, __dst, &self.__plan) }; },
} false => TokenStream2::new(),
}) };
.unwrap_or_default();
// A gathered lane owns its record, so the plan reads straight off it. // A gathered lane owns its record, so the plan reads straight off it.
let gather_carry = gather_carrier let gather_carry = match gather_carrier {
.then(|| { true => quote! {
quote! { let __src_rec = __element.rec();
let __src_rec = __element.rec(); unsafe { #core_types::record::apply_plan(__src_rec, __dst, &self.__plan) };
unsafe { #core_types::record::apply_plan(__src_rec, __dst, &self.__plan) }; },
} false => TokenStream2::new(),
}) };
.unwrap_or_default();
let carrier_read_bindings: Vec<TokenStream2> = match skips_carrier || lazy_carrier { let carrier_read_bindings: Vec<TokenStream2> = match skips_carrier || lazy_carrier {
true => Vec::new(), true => Vec::new(),
false => reads_of(0).into_iter().map(|(slot, read)| read_binding(slot, read, quote!(__src_rec))).collect(), false => reads_of(0).into_iter().map(|(slot, read)| read_binding(slot, read, quote!(__src_rec))).collect(),
+1
View File
@@ -167,6 +167,7 @@ where
/// One output lane of the mirror over its legacy-converted level: the source /// One output lane of the mirror over its legacy-converted level: the source
/// row's element and standard attributes, the reflection composed onto the /// row's element and standard attributes, the reflection composed onto the
/// mirrored half's transforms. /// mirrored half's transforms.
#[allow(clippy::type_complexity)]
fn mirror_lane<'e, T: Clone + Default + Send + Sync + 'static>( fn mirror_lane<'e, T: Clone + Default + Send + Sync + 'static>(
arena: &'e core_types::arena::Arena, arena: &'e core_types::arena::Arena,
legacy: List<T>, legacy: List<T>,
+1
View File
@@ -21,6 +21,7 @@ pub use vector_types::vector::misc::BooleanOperation;
// TODO: since before we used a Vec of single-item `List`s and now we use a single `List` // TODO: since before we used a Vec of single-item `List`s and now we use a single `List`
// TODO: with multiple items while still assuming a single item for the boolean operations. // TODO: with multiple items while still assuming a single item for the boolean operations.
#[allow(clippy::type_complexity)]
fn boolean_core<'e>( fn boolean_core<'e>(
arena: &'e core_types::arena::Arena, arena: &'e core_types::arena::Arena,
content: List<Graphic>, content: List<Graphic>,
+11 -4
View File
@@ -112,7 +112,7 @@ fn assign_colors<'e>(
let carried = carried_lane_attrs(ctx.arena(), *content.lane(lane))?; let carried = carried_lane_attrs(ctx.arena(), *content.lane(lane))?;
let (transform, layer_path) = carried; let (transform, layer_path) = carried;
if gradient.len() == 0 { if gradient.is_empty() {
return Ok((element, transform, Attr(existing_fill), Attr(existing_stroke), layer_path)); return Ok((element, transform, Attr(existing_fill), Attr(existing_stroke), layer_path));
} }
let gradient_element = gradient.element_ref(0); let gradient_element = gradient.element_ref(0);
@@ -140,6 +140,7 @@ fn assign_colors<'e>(
Ok((element, transform, Attr(fill_attr), Attr(stroke_attr), layer_path)) Ok((element, transform, Attr(fill_attr), Attr(stroke_attr), layer_path))
} }
#[allow(clippy::too_many_arguments)]
fn assign_colors_extent( fn assign_colors_extent(
content: ListIn<'_, Vector>, content: ListIn<'_, Vector>,
_fill: ValueIn<'_, bool>, _fill: ValueIn<'_, bool>,
@@ -179,7 +180,7 @@ fn assign_colors_graphic<'e>(
let mut element = graphic_types::graphic::map_groups_to_legacy(content.element_ref(lane)); let mut element = graphic_types::graphic::map_groups_to_legacy(content.element_ref(lane));
let (transform, layer_path) = carried_lane_attrs(ctx.arena(), *content.lane(lane))?; let (transform, layer_path) = carried_lane_attrs(ctx.arena(), *content.lane(lane))?;
if gradient.len() == 0 { if gradient.is_empty() {
return Ok((element, transform, layer_path)); return Ok((element, transform, layer_path));
} }
let gradient_element = gradient.element_ref(0); let gradient_element = gradient.element_ref(0);
@@ -217,6 +218,7 @@ fn assign_colors_graphic<'e>(
Ok((element, transform, layer_path)) Ok((element, transform, layer_path))
} }
#[allow(clippy::too_many_arguments)]
fn assign_colors_graphic_extent( fn assign_colors_graphic_extent(
content: ListIn<'_, Graphic>, content: ListIn<'_, Graphic>,
_fill: ValueIn<'_, bool>, _fill: ValueIn<'_, bool>,
@@ -236,7 +238,7 @@ fn assign_colors_graphic_extent(
pub use _assign_colors_graphic_mod::assign_colors_graphic_entries; pub use _assign_colors_graphic_mod::assign_colors_graphic_entries;
fn park_paint<'e>(arena: &'e core_types::arena::Arena, paint: List<Graphic>) -> Result<&'e List<Graphic>, Interrupt> { fn park_paint(arena: &core_types::arena::Arena, paint: List<Graphic>) -> Result<&List<Graphic>, Interrupt> {
let (parked, _) = arena.alloc(paint).ok_or(GraphError { let (parked, _) = arena.alloc(paint).ok_or(GraphError {
kind: core_types::gpoll::ErrorKind::ArenaExhausted, kind: core_types::gpoll::ErrorKind::ArenaExhausted,
trace: Vec::new(), trace: Vec::new(),
@@ -548,6 +550,7 @@ fn copy_to_points<T>(
/// The pushed level holds one copy per point (a data-dependent count, so the /// The pushed level holds one copy per point (a data-dependent count, so the
/// points level materializes here; its cone stays small); inner levels /// points level materializes here; its cone stays small); inner levels
/// forward to the content, taken uniform across copies. /// forward to the content, taken uniform across copies.
#[allow(clippy::too_many_arguments)]
fn copy_to_points_extent( fn copy_to_points_extent(
content: ExtentIn<'_>, content: ExtentIn<'_>,
points: ListIn<'_, Vector>, points: ListIn<'_, Vector>,
@@ -1436,6 +1439,7 @@ fn solidify_stroke_core(graphic_list: List<Graphic>) -> List<Vector> {
output output
} }
#[allow(clippy::type_complexity)]
fn solidify_lane<'e>( fn solidify_lane<'e>(
arena: &'e core_types::arena::Arena, arena: &'e core_types::arena::Arena,
graphic_list: List<Graphic>, graphic_list: List<Graphic>,
@@ -1460,6 +1464,7 @@ fn solidify_lane<'e>(
/// One lane of a legacy result list as the element and standard-attribute /// One lane of a legacy result list as the element and standard-attribute
/// tuple a fold kernel emits. /// tuple a fold kernel emits.
#[allow(clippy::type_complexity)]
fn emit_legacy_lane<'e>( fn emit_legacy_lane<'e>(
arena: &'e core_types::arena::Arena, arena: &'e core_types::arena::Arena,
output: List<Vector>, output: List<Vector>,
@@ -1492,7 +1497,7 @@ fn emit_legacy_lane<'e>(
let element = output.element(lane).cloned().unwrap_or_default(); let element = output.element(lane).cloned().unwrap_or_default();
let fill = output.attribute::<List<Graphic>>(ATTR_FILL, lane).map(|paint| park_paint(arena, paint.clone())).transpose()?; let fill = output.attribute::<List<Graphic>>(ATTR_FILL, lane).map(|paint| park_paint(arena, paint.clone())).transpose()?;
let stroke = output.attribute::<List<Graphic>>(ATTR_STROKE, lane).map(|paint| park_paint(arena, paint.clone())).transpose()?; let stroke = output.attribute::<List<Graphic>>(ATTR_STROKE, lane).map(|paint| park_paint(arena, paint.clone())).transpose()?;
let layer_path: Vec<NodeId> = output.attribute::<Vec<NodeId>>(ATTR_EDITOR_LAYER_PATH, lane).map(|path| path.clone()).unwrap_or_default(); let layer_path: Vec<NodeId> = output.attribute::<Vec<NodeId>>(ATTR_EDITOR_LAYER_PATH, lane).cloned().unwrap_or_default();
let layer_path = arena.alloc(layer_path).ok_or_else(exhausted)?.0; let layer_path = arena.alloc(layer_path).ok_or_else(exhausted)?.0;
let merged_layers = output let merged_layers = output
.attribute::<List<Graphic>>(ATTR_EDITOR_MERGED_LAYERS, lane) .attribute::<List<Graphic>>(ATTR_EDITOR_MERGED_LAYERS, lane)
@@ -1728,6 +1733,7 @@ fn map_points_extent(content: ListIn<'_, Vector>, _mapped: ExtentIn<'_>, level:
subject_counts_extent(content, level) subject_counts_extent(content, level)
} }
#[allow(clippy::type_complexity)]
fn flatten_path_core<'e>( fn flatten_path_core<'e>(
arena: &'e core_types::arena::Arena, arena: &'e core_types::arena::Arena,
graphic_list: List<Graphic>, graphic_list: List<Graphic>,
@@ -3166,6 +3172,7 @@ fn morph_core(content: List<Graphic>, progression: f64, reverse: bool, distribut
/// The morph over its legacy-converted level, one blank lane when there is /// The morph over its legacy-converted level, one blank lane when there is
/// nothing to interpolate. /// nothing to interpolate.
#[allow(clippy::type_complexity)]
fn morph_lane<'e>( fn morph_lane<'e>(
arena: &'e core_types::arena::Arena, arena: &'e core_types::arena::Arena,
content: List<Graphic>, content: List<Graphic>,