mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-20 11:28:30 +08:00
Clear the remaining clippy warnings on the diff surface
This commit is contained in:
@@ -83,10 +83,7 @@ fn brush_stamp_generator(_: impl Ctx, #[unit(" px")] diameter: f64, color: Color
|
||||
|
||||
/// Used to efficiently paint brush strokes. Applies the same texture repeatedly at different positions with proper blending and boundary handling.
|
||||
#[node_macro::node(category(""), skip_impl)]
|
||||
fn blit<BlendFn>(_: impl Ctx, mut target: List<Raster<CPU>>, texture: Raster<CPU>, positions: Vec<DVec2>, blend_mode: BlendFn) -> List<Raster<CPU>>
|
||||
where
|
||||
BlendFn: Fn(Color, Color) -> Color,
|
||||
{
|
||||
fn blit<BlendFn: Fn(Color, Color) -> Color>(_: impl Ctx, mut target: List<Raster<CPU>>, texture: Raster<CPU>, positions: Vec<DVec2>, blend_mode: BlendFn) -> List<Raster<CPU>> {
|
||||
if positions.is_empty() {
|
||||
return target;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ fn read_gradient(ctx: impl Ctx + ExtractVarArgs) -> List<GradientStops> {
|
||||
}
|
||||
|
||||
/// The mapped row riding as vararg 0, in the production single-item shape.
|
||||
fn vararg_list<'a, T: 'static>(ctx: &'a impl ExtractVarArgs) -> Option<&'a List<T>> {
|
||||
fn vararg_list<T: 'static>(ctx: &impl ExtractVarArgs) -> Option<&List<T>> {
|
||||
let arg = ctx.vararg(0).ok()?;
|
||||
(arg as &dyn std::any::Any).downcast_ref::<List<T>>()
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ fn memoize<'e, 'l>(
|
||||
return serve(entry, slot);
|
||||
}
|
||||
if leveled {
|
||||
return match content.materialize_level(&ctx, ctx.arena()) {
|
||||
return match content.materialize_level(ctx, ctx.arena()) {
|
||||
LevelStatus::Batch(batch, finality) => {
|
||||
let layout = content.layout();
|
||||
// SAFETY: the batch came from this input, so it carries the input's layout.
|
||||
@@ -107,7 +107,7 @@ fn memoize<'e, 'l>(
|
||||
};
|
||||
}
|
||||
// The output layout is the content's, so the claim is the content's frame.
|
||||
let result = content.serve(&ctx, slot);
|
||||
let result = content.serve(ctx, slot);
|
||||
let publishable = match &result {
|
||||
GPoll::Final(served) => Some((served.record(), Finality::AllFinal)),
|
||||
GPoll::Partial(served) => Some((served.record(), Finality::Partial)),
|
||||
@@ -196,7 +196,7 @@ fn frame_memo<'e, 'l>(
|
||||
return serve(published.get(lane).rec().ptr(), finality, slot);
|
||||
}
|
||||
if leveled {
|
||||
return match content.materialize_level(&ctx, ctx.arena()) {
|
||||
return match content.materialize_level(ctx, ctx.arena()) {
|
||||
LevelStatus::Batch(batch, finality) => {
|
||||
// SAFETY: the batch came from this input, so it carries the input's layout.
|
||||
let span = unsafe { MaterializedSpan::to_persistent(&batch, &promotion) };
|
||||
@@ -212,7 +212,7 @@ fn frame_memo<'e, 'l>(
|
||||
};
|
||||
}
|
||||
// The output layout is the content's, so the claim is the content's frame.
|
||||
let result = content.serve(&ctx, slot);
|
||||
let result = content.serve(ctx, slot);
|
||||
let publishable = match &result {
|
||||
GPoll::Final(served) => Some((served.record(), Finality::AllFinal)),
|
||||
GPoll::Partial(served) => Some((served.record(), Finality::Partial)),
|
||||
@@ -246,7 +246,7 @@ fn monitor<'e, 'l>(
|
||||
if ctx.index() == 0 {
|
||||
*io.lock().unwrap() = Some(CtxSnapshot::capture(ctx));
|
||||
}
|
||||
content.serve(&ctx, slot)
|
||||
content.serve(ctx, slot)
|
||||
}
|
||||
|
||||
fn serialize_monitor(io: &MonitorValue) -> Option<Arc<dyn std::any::Any + Send + Sync>> {
|
||||
|
||||
@@ -2983,8 +2983,8 @@ mod tests {
|
||||
{
|
||||
let scope = scope_fixture(&generations, &first_arena).with_persistent(&persistent);
|
||||
let ctx = ContextImpl::root(&scope);
|
||||
let mut first = frames.reborrow();
|
||||
let GPoll::Final(_) = core_types::record::serve_input(&memo, &ctx, &mut first) else {
|
||||
let first = frames.reborrow();
|
||||
let GPoll::Final(_) = core_types::record::serve_input(&memo, &ctx, &first) else {
|
||||
panic!("expected a final record");
|
||||
};
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ where
|
||||
}
|
||||
let fill = park_paint(legacy.attribute::<Option<List<Graphic>>>(graphic_types::ATTR_FILL, source).cloned().flatten())?;
|
||||
let stroke = park_paint(legacy.attribute::<Option<List<Graphic>>>(graphic_types::ATTR_STROKE, source).cloned().flatten())?;
|
||||
let layer_path: Vec<NodeId> = legacy.attribute::<Vec<NodeId>>(ATTR_EDITOR_LAYER_PATH, source).map(|path| path.clone()).unwrap_or_default();
|
||||
let layer_path: Vec<NodeId> = legacy.attribute::<Vec<NodeId>>(ATTR_EDITOR_LAYER_PATH, source).cloned().unwrap_or_default();
|
||||
let layer_path = arena.alloc(layer_path).ok_or_else(exhausted)?.0;
|
||||
|
||||
Ok((
|
||||
|
||||
@@ -885,8 +885,7 @@ mod tests {
|
||||
let GPoll::Final(value) = record::serve_input(&wrapped, &ctx.promoted(&head, 0), &scope) else {
|
||||
panic!("expected a final record");
|
||||
};
|
||||
let group = unsafe { record::borrow_element::<Graphic>(wrap_out.rec(&value)) }.clone();
|
||||
group
|
||||
unsafe { record::borrow_element::<Graphic>(wrap_out.rec(&value)) }.clone()
|
||||
};
|
||||
|
||||
// One row holding the wrapped group flattens back to the lanes, the
|
||||
|
||||
@@ -78,7 +78,7 @@ fn boolean_core<'e>(
|
||||
use core_types::lane::LaneSource;
|
||||
let fill = park_paint(result_vector_list.attr::<Fill>(0).filter(|paint| is_paint_present(paint)).cloned())?;
|
||||
let stroke = park_paint(result_vector_list.attr::<Stroke>(0).filter(|paint| is_paint_present(paint)).cloned())?;
|
||||
let layer_path: Vec<NodeId> = result_vector_list.attribute::<Vec<NodeId>>(ATTR_EDITOR_LAYER_PATH, 0).map(|path| path.clone()).unwrap_or_default();
|
||||
let layer_path: Vec<NodeId> = result_vector_list.attribute::<Vec<NodeId>>(ATTR_EDITOR_LAYER_PATH, 0).cloned().unwrap_or_default();
|
||||
let layer_path = arena.alloc(layer_path).ok_or_else(exhausted)?.0;
|
||||
// Snapshot the input layers so the renderer can recurse into them for
|
||||
// editor click-target preservation.
|
||||
|
||||
@@ -433,7 +433,7 @@ mod tests {
|
||||
#[test]
|
||||
fn qr_code_test() {
|
||||
let qr = qr_code(&(), (), "https://graphite.art".to_string(), false, 1., QRCodeErrorCorrectionLevel::Low, true);
|
||||
assert!(qr.point_domain.ids().len() > 0);
|
||||
assert!(qr.segment_domain.ids().len() > 0);
|
||||
assert!(!qr.point_domain.ids().is_empty());
|
||||
assert!(!qr.segment_domain.ids().is_empty());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1577,7 +1577,7 @@ fn emit_legacy_lane<'e>(
|
||||
/// one group lane, lane 0's layer path stamped on the wrapper.
|
||||
fn wrap_vector_level(content: core_types::node::List<'_, Vector>) -> List<Graphic<'_>> {
|
||||
let item = content.as_group_item();
|
||||
let layer_path: Vec<NodeId> = match content.len() > 0 {
|
||||
let layer_path: Vec<NodeId> = match !content.is_empty() {
|
||||
true => content.lane(0).attr::<EditorLayerPath>().to_vec(),
|
||||
false => Vec::new(),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user