@@ -2192,32 +2192,34 @@ impl NodeNetworkInterface {
21922192 for ( input_index, input) in node. inputs . iter ( ) . enumerate ( ) {
21932193 if let NodeInput :: Node { node_id, output_index, .. } = input {
21942194 // If this errors then there is an input to a node that does not exist
2195- let outward_wires_entry = outward_wires. get_mut ( & OutputConnector :: node ( * node_id, * output_index) ) . expect ( & format ! (
2196- "Output connector {:?} should be initialized for each node output from a node" ,
2197- OutputConnector :: node( * node_id, * output_index)
2198- ) ) ;
2195+ let outward_wires_entry = outward_wires. get_mut ( & OutputConnector :: node ( * node_id, * output_index) ) . unwrap_or_else ( || {
2196+ panic ! (
2197+ "Output connector {:?} should be initialized for each node output from a node" ,
2198+ OutputConnector :: node( * node_id, * output_index)
2199+ )
2200+ } ) ;
21992201 outward_wires_entry. push ( InputConnector :: node ( * current_node_id, input_index) ) ;
22002202 } else if let NodeInput :: Network { import_index, .. } = input {
2201- let outward_wires_entry = outward_wires. get_mut ( & OutputConnector :: Import ( * import_index) ) . expect ( & format ! (
2202- "Output connector {:?} should be initialized for each import from a node" ,
2203- OutputConnector :: Import ( * import_index)
2204- ) ) ;
2203+ let outward_wires_entry = outward_wires
2204+ . get_mut ( & OutputConnector :: Import ( * import_index) )
2205+ . unwrap_or_else ( || panic ! ( "Output connector {:?} should be initialized for each import from a node" , OutputConnector :: Import ( * import_index) ) ) ;
22052206 outward_wires_entry. push ( InputConnector :: node ( * current_node_id, input_index) ) ;
22062207 }
22072208 }
22082209 }
22092210 for ( export_index, export) in network. exports . iter ( ) . enumerate ( ) {
22102211 if let NodeInput :: Node { node_id, output_index, .. } = export {
2211- let outward_wires_entry = outward_wires. get_mut ( & OutputConnector :: node ( * node_id, * output_index) ) . expect ( & format ! (
2212- "Output connector {:?} should be initialized for each node input from exports" ,
2213- OutputConnector :: node( * node_id, * output_index)
2214- ) ) ;
2212+ let outward_wires_entry = outward_wires. get_mut ( & OutputConnector :: node ( * node_id, * output_index) ) . unwrap_or_else ( || {
2213+ panic ! (
2214+ "Output connector {:?} should be initialized for each node input from exports" ,
2215+ OutputConnector :: node( * node_id, * output_index)
2216+ )
2217+ } ) ;
22152218 outward_wires_entry. push ( InputConnector :: Export ( export_index) ) ;
22162219 } else if let NodeInput :: Network { import_index, .. } = export {
2217- let outward_wires_entry = outward_wires. get_mut ( & OutputConnector :: Import ( * import_index) ) . expect ( & format ! (
2218- "Output connector {:?} should be initialized between imports and exports" ,
2219- OutputConnector :: Import ( * import_index)
2220- ) ) ;
2220+ let outward_wires_entry = outward_wires
2221+ . get_mut ( & OutputConnector :: Import ( * import_index) )
2222+ . unwrap_or_else ( || panic ! ( "Output connector {:?} should be initialized between imports and exports" , OutputConnector :: Import ( * import_index) ) ) ;
22212223 outward_wires_entry. push ( InputConnector :: Export ( export_index) ) ;
22222224 }
22232225 }
@@ -4298,7 +4300,7 @@ impl NodeNetworkInterface {
42984300 let valid_upstream_chain_nodes = self . valid_upstream_chain_nodes ( input_connector, network_path) ;
42994301
43004302 for node_id in & valid_upstream_chain_nodes {
4301- self . set_chain_position ( & node_id, network_path) ;
4303+ self . set_chain_position ( node_id, network_path) ;
43024304 }
43034305 // Reload click target of the layer which used to encapsulate the node
43044306 if !valid_upstream_chain_nodes. is_empty ( ) {
0 commit comments