@@ -9,7 +9,6 @@ use alloc::{
99use core:: cell:: { Cell , RefCell } ;
1010
1111use derivative:: Derivative ;
12- use itertools:: Itertools ;
1312#[ allow( unused_imports) ]
1413use num_traits:: float:: FloatCore ;
1514use replace_with:: replace_with_or_default_and_return;
@@ -90,14 +89,14 @@ impl Processor {
9089 // finally, get the link name
9190
9291 // link name prefix, eg "processor"
93- let split = other. block . name . split ( '-' ) . collect_vec ( ) ;
94- let name_prefix = if split . len ( ) >= 2
95- && ( split [ split . len ( ) - 1 ] == "large"
96- || split [ split . len ( ) - 1 ] . parse :: < f64 > ( ) . is_ok ( ) )
92+ let mut parts = other. block . name . rsplit ( '-' ) ;
93+ let last_part = parts . next ( ) . unwrap_or ( "" ) ;
94+ let name_prefix = if let Some ( second_last_part ) = parts . next ( )
95+ && ( last_part == "large" || last_part . parse :: < f64 > ( ) . is_ok ( ) )
9796 {
98- split [ split . len ( ) - 2 ]
97+ second_last_part
9998 } else {
100- split [ split . len ( ) - 1 ]
99+ last_part
101100 } ;
102101
103102 // link indices that are already in use for this prefix
@@ -177,7 +176,7 @@ impl Processor {
177176
178177 // set_initial_config assumes the processor is disabled and increments running_processors if it becomes enabled
179178 // so decrement running_processors if the processor is currently enabled to avoid double-counting
180- let prev_running_processors = Cell :: get ( & * vm. running_processors ) ;
179+ let prev_running_processors = vm. running_processors . get ( ) ;
181180 if self . state . enabled {
182181 vm. running_processors . update ( |n| n - 1 ) ;
183182 }
0 commit comments