-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Box big enum variants to satisfy Clippy's lint warnings #4292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Keavon
wants to merge
4
commits into
master
Choose a base branch
from
box-big-enum-variants
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+38
−37
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
86cccde
Box the `value` field of `NodeGraphMessage::SetInputValue`
Keavon 01bcc08
Box the `ExecutionResponse` variant of `NodeGraphUpdate`
Keavon 108d81c
Box the `Layer` variant of `NodeTypeClickTargets`
Keavon 31a0ae8
Box the `Scope` variant of `ParsedValueSource`
Keavon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,7 +41,10 @@ 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) => { | ||
| let value = Box::new(value); | ||
| NodeGraphMessage::SetInputValue { node_id, input_index, value }.into() | ||
| } | ||
|
Keavon marked this conversation as resolved.
|
||
| None => Message::NoOp, | ||
| } | ||
| } | ||
|
|
@@ -831,7 +834,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: Box::new(TaggedValue::Resource(resource_id)), | ||
| } | ||
| .into(), | ||
| ]), | ||
|
|
@@ -1401,7 +1404,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: Box::new(TaggedValue::F32(percent.clamp(0., 100.) as f32)), | ||
| } | ||
| .into() | ||
| } | ||
|
|
@@ -1558,7 +1561,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: Box::new(TaggedValue::F32(position_to_value(new_position).clamp(value_min, value_max) as f32)), | ||
| } | ||
| .into() | ||
| }) | ||
|
|
@@ -2112,13 +2115,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: Box::new(TaggedValue::Bool(true)), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For these I would generally prefer to write this using |
||
| } | ||
| .into(), | ||
| NodeGraphMessage::SetInputValue { | ||
| node_id, | ||
| input_index: JoinerInput::INDEX, | ||
| value: TaggedValue::String(value.clone()), | ||
| value: Box::new(TaggedValue::String(value.clone())), | ||
| } | ||
| .into(), | ||
| ]), | ||
|
|
@@ -2178,13 +2181,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: Box::new(TaggedValue::Bool(false)), | ||
| } | ||
| .into(), | ||
| NodeGraphMessage::SetInputValue { | ||
| node_id, | ||
| input_index: CornerRadiusInput::<f64>::INDEX, | ||
| value: TaggedValue::F64(uniform_val), | ||
| value: Box::new(TaggedValue::F64(uniform_val)), | ||
| } | ||
| .into(), | ||
| ]), | ||
|
|
@@ -2198,13 +2201,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: Box::new(TaggedValue::Bool(true)), | ||
| } | ||
| .into(), | ||
| NodeGraphMessage::SetInputValue { | ||
| node_id, | ||
| input_index: CornerRadiusInput::<f64>::INDEX, | ||
| value: TaggedValue::F64Array(individual_val_for_switch.clone()), | ||
| value: Box::new(TaggedValue::F64Array(individual_val_for_switch.clone())), | ||
| } | ||
| .into(), | ||
| ]), | ||
|
|
@@ -2454,13 +2457,13 @@ pub(crate) fn fill_properties(node_id: NodeId, context: &mut NodePropertiesConte | |
| NodeGraphMessage::SetInputValue { | ||
| node_id, | ||
| input_index: backup_index, | ||
| value: backup_value, | ||
| value: Box::new(backup_value), | ||
| } | ||
| .into(), | ||
| NodeGraphMessage::SetInputValue { | ||
| node_id, | ||
| input_index: FillInput::<Color>::INDEX, | ||
| value: TaggedValue::Fill(new_fill), | ||
| value: Box::new(TaggedValue::Fill(new_fill)), | ||
| } | ||
| .into(), | ||
| ]), | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit ugly since without inlay hints, it is a bit hard to understand what this does. We could change the name of one of the variables to make this clearer, but this is not a big issue