Box big enum variants to satisfy Clippy's lint warnings (#4292)

* Box the `value` field of `NodeGraphMessage::SetInputValue`

* Box the `ExecutionResponse` variant of `NodeGraphUpdate`

* Box the `Layer` variant of `NodeTypeClickTargets`

* Box the `Scope` variant of `ParsedValueSource`
This commit is contained in:
Keavon Chambers
2026-07-26 11:50:23 -07:00
committed by GitHub
parent 0bce26c54e
commit 9332c7f775
14 changed files with 54 additions and 38 deletions

View File

@@ -157,7 +157,7 @@ pub enum NodeGraphMessage {
SetInputValue {
node_id: NodeId,
input_index: usize,
value: TaggedValue,
value: Box<TaggedValue>,
},
SetInput {
input_connector: InputConnector,

View File

@@ -1762,7 +1762,7 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
.any(|id| *r == DefinitionIdentifier::ProtoNode(id))
});
let input = NodeInput::value(value, false);
let input = NodeInput::value(*value, false);
responses.add(NodeGraphMessage::SetInput {
input_connector: InputConnector::node(node_id, input_index),
input,

View File

@@ -47,7 +47,12 @@ pub(crate) fn string_properties(text: &str) -> Vec<LayoutGroup> {
fn optionally_update_value<T>(value: impl Fn(&T) -> Option<TaggedValue> + 'static + Send + Sync, node_id: NodeId, input_index: usize) -> impl Fn(&T) -> Message + 'static + Send + Sync {
move |input_value: &T| match value(input_value) {
Some(value) => NodeGraphMessage::SetInputValue { node_id, input_index, value }.into(),
Some(value) => NodeGraphMessage::SetInputValue {
node_id,
input_index,
value: value.into(),
}
.into(),
None => Message::NoOp,
}
}
@@ -901,7 +906,7 @@ pub fn font_inputs(parameter_widgets_info: ParameterWidgetsInfo) -> (Vec<WidgetI
NodeGraphMessage::SetInputValue {
node_id,
input_index: graphene_std::text::text::FontInput::INDEX,
value: TaggedValue::Resource(resource_id),
value: TaggedValue::Resource(resource_id).into(),
}
.into(),
]),
@@ -1478,7 +1483,7 @@ fn build_shared_spectrum_section(node_id: NodeId, context: &mut NodePropertiesCo
NodeGraphMessage::SetInputValue {
node_id,
input_index,
value: TaggedValue::F32(percent.clamp(0., 100.) as f32),
value: TaggedValue::F32(percent.clamp(0., 100.) as f32).into(),
}
.into()
}
@@ -1635,7 +1640,7 @@ fn spectrum_slider_row(
NodeGraphMessage::SetInputValue {
node_id,
input_index,
value: TaggedValue::F32(position_to_value(new_position).clamp(value_min, value_max) as f32),
value: TaggedValue::F32(position_to_value(new_position).clamp(value_min, value_max) as f32).into(),
}
.into()
})
@@ -2189,13 +2194,13 @@ pub(crate) fn string_capitalization_properties(node_id: NodeId, context: &mut No
NodeGraphMessage::SetInputValue {
node_id,
input_index: UseJoinerInput::INDEX,
value: TaggedValue::Bool(true),
value: TaggedValue::Bool(true).into(),
}
.into(),
NodeGraphMessage::SetInputValue {
node_id,
input_index: JoinerInput::INDEX,
value: TaggedValue::String(value.clone()),
value: TaggedValue::String(value.clone()).into(),
}
.into(),
]),
@@ -2250,13 +2255,13 @@ pub(crate) fn rectangle_properties(node_id: NodeId, context: &mut NodeProperties
NodeGraphMessage::SetInputValue {
node_id,
input_index: IndividualCornerRadiiInput::INDEX,
value: TaggedValue::Bool(false),
value: TaggedValue::Bool(false).into(),
}
.into(),
NodeGraphMessage::SetInputValue {
node_id,
input_index: CornerRadiusInput::INDEX,
value: TaggedValue::BoxCorners(BoxCorners::from(uniform_val)),
value: TaggedValue::BoxCorners(BoxCorners::from(uniform_val)).into(),
}
.into(),
]),
@@ -2269,13 +2274,13 @@ pub(crate) fn rectangle_properties(node_id: NodeId, context: &mut NodeProperties
NodeGraphMessage::SetInputValue {
node_id,
input_index: IndividualCornerRadiiInput::INDEX,
value: TaggedValue::Bool(true),
value: TaggedValue::Bool(true).into(),
}
.into(),
NodeGraphMessage::SetInputValue {
node_id,
input_index: CornerRadiusInput::INDEX,
value: TaggedValue::BoxCorners(BoxCorners::from(corner_values.to_vec())),
value: TaggedValue::BoxCorners(BoxCorners::from(corner_values.to_vec())).into(),
}
.into(),
]),
@@ -2577,7 +2582,7 @@ pub(crate) fn fill_properties(node_id: NodeId, context: &mut NodePropertiesConte
NodeGraphMessage::SetInputValue {
node_id,
input_index: FillInput::<List<Graphic>>::INDEX,
value: color.map_or_else(TaggedValue::no_paint, TaggedValue::Color),
value: color.map_or_else(TaggedValue::no_paint, TaggedValue::Color).into(),
}
.into(),
];
@@ -2586,7 +2591,7 @@ pub(crate) fn fill_properties(node_id: NodeId, context: &mut NodePropertiesConte
NodeGraphMessage::SetInputValue {
node_id,
input_index: BackupColorInput::INDEX,
value: TaggedValue::Color(color),
value: TaggedValue::Color(color).into(),
}
.into(),
);
@@ -2599,13 +2604,13 @@ pub(crate) fn fill_properties(node_id: NodeId, context: &mut NodePropertiesConte
NodeGraphMessage::SetInputValue {
node_id,
input_index: FillInput::<List<Graphic>>::INDEX,
value: TaggedValue::Gradient(gradient.clone()),
value: TaggedValue::Gradient(gradient.clone()).into(),
}
.into(),
NodeGraphMessage::SetInputValue {
node_id,
input_index: BackupGradientInput::INDEX,
value: TaggedValue::Gradient(gradient),
value: TaggedValue::Gradient(gradient).into(),
}
.into(),
]),
@@ -2714,13 +2719,13 @@ pub(crate) fn fill_properties(node_id: NodeId, context: &mut NodePropertiesConte
NodeGraphMessage::SetInputValue {
node_id,
input_index: HasTransformInput::INDEX,
value: TaggedValue::Bool(true),
value: TaggedValue::Bool(true).into(),
}
.into(),
NodeGraphMessage::SetInputValue {
node_id,
input_index: TransformInput::INDEX,
value: TaggedValue::DAffine2(new_transform),
value: TaggedValue::DAffine2(new_transform).into(),
}
.into(),
]),

View File

@@ -747,7 +747,7 @@ async fn none_fill_survives_document_reopen() {
.handle_message(NodeGraphMessage::SetInputValue {
node_id: fill_node_id,
input_index: graphene_std::vector::fill::FillInput::<graphene_std::list::List<graphene_std::Graphic>>::INDEX,
value: graph_craft::document::value::TaggedValue::no_paint(),
value: graph_craft::document::value::TaggedValue::no_paint().into(),
})
.await;
assert!(fill_paint_value(editor.active_document()).is_no_paint(), "the None pick should store as no_paint");

View File

@@ -1106,12 +1106,12 @@ impl NodeNetworkInterface {
DocumentNodeClickTargets {
node_click_target,
port_click_targets,
node_type_metadata: NodeTypeClickTargets::Layer(LayerClickTargets {
node_type_metadata: NodeTypeClickTargets::Layer(Box::new(LayerClickTargets {
visibility_click_target,
lock_click_target,
grip_click_target,
name_click_target,
}),
})),
}
};

View File

@@ -736,7 +736,7 @@ pub struct DocumentNodeClickTargets {
#[derive(Debug, Clone)]
pub enum NodeTypeClickTargets {
Layer(LayerClickTargets),
Layer(Box<LayerClickTargets>),
Node, // No transient click targets are stored exclusively for nodes
}

View File

@@ -615,7 +615,11 @@ pub fn set_stroke_weight_for_selected_layers(weight: f64, document: &DocumentMes
if let Some(node_id) = get_stroke_id(layer, &document.network_interface) {
let input_index = graphene_std::vector::stroke::WeightInput::INDEX;
let value = TaggedValue::F64(weight);
responses.add(NodeGraphMessage::SetInputValue { node_id, input_index, value });
responses.add(NodeGraphMessage::SetInputValue {
node_id,
input_index,
value: value.into(),
});
} else if weight > 0. {
let color = Some(Color::BLACK);
let stroke = graphene_std::vector::style::Stroke::default().with_weight(weight);
@@ -834,7 +838,11 @@ pub fn set_stroke_color_for_selected_layers(color: Option<Color>, weight: f64, d
if let Some(node_id) = get_stroke_id(layer, &document.network_interface) {
let input_index = graphene_std::vector::stroke::PaintInput::<List<Graphic>>::INDEX;
let value = color.map_or_else(TaggedValue::no_paint, TaggedValue::Color);
responses.add(NodeGraphMessage::SetInputValue { node_id, input_index, value });
responses.add(NodeGraphMessage::SetInputValue {
node_id,
input_index,
value: value.into(),
});
} else {
let stroke = graphene_std::vector::style::Stroke::new(weight);
responses.add(GraphOperationMessage::StrokeSet { layer, color, stroke });
@@ -904,7 +912,7 @@ pub fn set_proto_node_input_for_selected_layers(
responses.add(NodeGraphMessage::SetInputValue {
node_id,
input_index,
value: value.clone(),
value: value.clone().into(),
});
}
}

View File

@@ -2159,7 +2159,8 @@ mod test_gradient {
midpoint: 0.5,
color: Color::BLUE,
},
])),
]))
.into(),
})
.await;
@@ -2196,7 +2197,8 @@ mod test_gradient {
midpoint: 0.5,
color: Color::BLUE,
},
])),
]))
.into(),
})
.await;
@@ -2839,7 +2841,8 @@ mod test_gradient {
midpoint: 0.5,
color: Color::BLUE,
},
])),
]))
.into(),
})
.await;

View File

@@ -118,7 +118,7 @@ fn create_text_widgets(tool: &TextTool, font_catalog: &FontCatalog, document: &D
NodeGraphMessage::SetInputValue {
node_id,
input_index: graphene_std::text::text::FontInput::INDEX,
value: TaggedValue::Resource(resource_id),
value: TaggedValue::Resource(resource_id).into(),
}
.into(),
]),
@@ -349,7 +349,7 @@ impl<'a> MessageHandler<ToolMessage, &mut ToolActionMessageContext<'a>> for Text
responses.add(NodeGraphMessage::SetInputValue {
node_id,
input_index: graphene_std::text::text::SizeInput::INDEX,
value: TaggedValue::F64(font_size),
value: TaggedValue::F64(font_size).into(),
});
}
}
@@ -364,7 +364,7 @@ impl<'a> MessageHandler<ToolMessage, &mut ToolActionMessageContext<'a>> for Text
responses.add(NodeGraphMessage::SetInputValue {
node_id,
input_index: graphene_std::text::text::AlignInput::INDEX,
value: TaggedValue::TextAlign(align),
value: TaggedValue::TextAlign(align).into(),
});
}
}

View File

@@ -48,7 +48,7 @@ pub struct CompilationResponse {
}
pub enum NodeGraphUpdate {
ExecutionResponse(ExecutionResponse),
ExecutionResponse(Box<ExecutionResponse>),
CompilationResponse(CompilationResponse),
EyedropperPreview(Raster<CPU>),
NodeGraphUpdateMessage(NodeGraphUpdateMessage),
@@ -365,7 +365,7 @@ impl NodeGraphExecutor {
responses: existing_responses,
vector_modify,
inspect_result,
} = execution_response;
} = *execution_response;
while let Some(&(queued_execution_id, _)) = self.futures.front() {
if queued_execution_id < execution_id {

View File

@@ -102,7 +102,7 @@ impl InternalNodeGraphUpdateSender {
}
fn send_execution_response(&self, response: ExecutionResponse) {
self.0.send(NodeGraphUpdate::ExecutionResponse(response)).expect("Failed to send response")
self.0.send(NodeGraphUpdate::ExecutionResponse(Box::new(response))).expect("Failed to send response")
}
fn send_eyedropper_preview(&self, raster: Raster<CPU>) {

View File

@@ -179,7 +179,7 @@ pub(crate) fn generate_node_code(crate_ident: &CrateIdent, parsed: &ParsedNodeFn
}
}
ParsedValueSource::Scope(data) => {
if let syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Str(_), .. }) = data {
if let syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Str(_), .. }) = data.as_ref() {
quote!(RegistryValueSource::Scope(#data))
} else {
quote!(RegistryValueSource::Scope(#data.as_static_str()))

View File

@@ -65,7 +65,7 @@ pub enum ParsedValueSource {
#[default]
None,
Default(TokenStream2),
Scope(Expr),
Scope(Box<Expr>),
}
// #[widget(ParsedWidgetOverride::Hidden)]
@@ -815,7 +815,7 @@ fn parse_field(pat_ident: PatIdent, ty: Type, attrs: &[Attribute]) -> syn::Resul
let value_source = match (default_value, scope) {
(Some(_), Some(_)) => return Err(Error::new_spanned(&pat_ident, "Cannot have both `default` and `scope` attributes")),
(Some(default_value), _) => ParsedValueSource::Default(default_value),
(_, Some(scope)) => ParsedValueSource::Scope(scope),
(_, Some(scope)) => ParsedValueSource::Scope(Box::new(scope)),
_ => ParsedValueSource::None,
};

View File

@@ -241,7 +241,7 @@ impl PerPixelAdjustCodegen<'_> {
ty: ParsedFieldType::classify(RegularParsedField {
ty: parse_quote!(#gcore::list::Item<&'a WgpuExecutor>),
exposed: true,
value_source: ParsedValueSource::Scope(parse_quote!("graphene_std::platform_application_io::WgpuExecutorNode")),
value_source: ParsedValueSource::Scope(Box::new(parse_quote!("graphene_std::platform_application_io::WgpuExecutorNode"))),
number_soft_min: None,
number_soft_max: None,
number_hard_min: None,