mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Quiet the clippy type-complexity and closure lints on the record kernels
This commit is contained in:
@@ -1611,7 +1611,7 @@ pub(crate) fn generate_node_impl(crate_ident: &CrateIdent, parsed: &ParsedNodeFn
|
||||
};
|
||||
let kernel = match async_fn {
|
||||
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
|
||||
},
|
||||
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);
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -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) };));
|
||||
// A lazy carrier's source record is the token the kernel returned; its
|
||||
// content frames sit above `__dst` and stay readable until the truncate.
|
||||
let lazy_carry = lazy_carrier
|
||||
.then(|| {
|
||||
quote! {
|
||||
let __src_rec = self.__carrier.rec(&__element);
|
||||
unsafe { #core_types::record::apply_plan(__src_rec, __dst, &self.__plan) };
|
||||
}
|
||||
})
|
||||
.unwrap_or_default();
|
||||
let lazy_carry = match lazy_carrier {
|
||||
true => quote! {
|
||||
let __src_rec = self.__carrier.rec(&__element);
|
||||
unsafe { #core_types::record::apply_plan(__src_rec, __dst, &self.__plan) };
|
||||
},
|
||||
false => TokenStream2::new(),
|
||||
};
|
||||
// A gathered lane owns its record, so the plan reads straight off it.
|
||||
let gather_carry = gather_carrier
|
||||
.then(|| {
|
||||
quote! {
|
||||
let __src_rec = __element.rec();
|
||||
unsafe { #core_types::record::apply_plan(__src_rec, __dst, &self.__plan) };
|
||||
}
|
||||
})
|
||||
.unwrap_or_default();
|
||||
let gather_carry = match gather_carrier {
|
||||
true => quote! {
|
||||
let __src_rec = __element.rec();
|
||||
unsafe { #core_types::record::apply_plan(__src_rec, __dst, &self.__plan) };
|
||||
},
|
||||
false => TokenStream2::new(),
|
||||
};
|
||||
let carrier_read_bindings: Vec<TokenStream2> = match skips_carrier || lazy_carrier {
|
||||
true => Vec::new(),
|
||||
false => reads_of(0).into_iter().map(|(slot, read)| read_binding(slot, read, quote!(__src_rec))).collect(),
|
||||
|
||||
@@ -167,6 +167,7 @@ where
|
||||
/// One output lane of the mirror over its legacy-converted level: the source
|
||||
/// row's element and standard attributes, the reflection composed onto the
|
||||
/// mirrored half's transforms.
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn mirror_lane<'e, T: Clone + Default + Send + Sync + 'static>(
|
||||
arena: &'e core_types::arena::Arena,
|
||||
legacy: List<T>,
|
||||
|
||||
@@ -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: with multiple items while still assuming a single item for the boolean operations.
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn boolean_core<'e>(
|
||||
arena: &'e core_types::arena::Arena,
|
||||
content: List<Graphic>,
|
||||
|
||||
@@ -112,7 +112,7 @@ fn assign_colors<'e>(
|
||||
let carried = carried_lane_attrs(ctx.arena(), *content.lane(lane))?;
|
||||
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));
|
||||
}
|
||||
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))
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn assign_colors_extent(
|
||||
content: ListIn<'_, Vector>,
|
||||
_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 (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));
|
||||
}
|
||||
let gradient_element = gradient.element_ref(0);
|
||||
@@ -217,6 +218,7 @@ fn assign_colors_graphic<'e>(
|
||||
Ok((element, transform, layer_path))
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn assign_colors_graphic_extent(
|
||||
content: ListIn<'_, Graphic>,
|
||||
_fill: ValueIn<'_, bool>,
|
||||
@@ -236,7 +238,7 @@ fn assign_colors_graphic_extent(
|
||||
|
||||
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 {
|
||||
kind: core_types::gpoll::ErrorKind::ArenaExhausted,
|
||||
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
|
||||
/// points level materializes here; its cone stays small); inner levels
|
||||
/// forward to the content, taken uniform across copies.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn copy_to_points_extent(
|
||||
content: ExtentIn<'_>,
|
||||
points: ListIn<'_, Vector>,
|
||||
@@ -1436,6 +1439,7 @@ fn solidify_stroke_core(graphic_list: List<Graphic>) -> List<Vector> {
|
||||
output
|
||||
}
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn solidify_lane<'e>(
|
||||
arena: &'e core_types::arena::Arena,
|
||||
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
|
||||
/// tuple a fold kernel emits.
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn emit_legacy_lane<'e>(
|
||||
arena: &'e core_types::arena::Arena,
|
||||
output: List<Vector>,
|
||||
@@ -1492,7 +1497,7 @@ fn emit_legacy_lane<'e>(
|
||||
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 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 merged_layers = output
|
||||
.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)
|
||||
}
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn flatten_path_core<'e>(
|
||||
arena: &'e core_types::arena::Arena,
|
||||
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
|
||||
/// nothing to interpolate.
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn morph_lane<'e>(
|
||||
arena: &'e core_types::arena::Arena,
|
||||
content: List<Graphic>,
|
||||
|
||||
Reference in New Issue
Block a user