File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -33,8 +33,15 @@ impl PrincipleVariation {
3333 ///
3434 /// Empty Result<> on success or an error if the underlying ArrayVec
3535 /// is full before trying to push.
36+ #[ allow( clippy:: panic) ]
3637 pub ( crate ) fn push ( & mut self , m : Move ) {
37- self . data . push ( m) ;
38+ self . data . try_push ( m) . unwrap_or_else ( |err| {
39+ panic ! (
40+ "Error extending PV of size {} when adding {}\n {err}" ,
41+ self . data. len( ) ,
42+ m
43+ ) ;
44+ } )
3845 }
3946
4047 /// Extend the current [PrincipleVariation] with the given move and another principle variation.
@@ -136,7 +143,7 @@ mod tests {
136143 }
137144
138145 #[ test]
139- #[ should_panic]
146+ #[ should_panic( expected = "Error extending PV" ) ]
140147 fn extending_or_pushing_move_past_max_size_panics ( ) {
141148 let ( move1, move2) = make_moves ( ) ;
142149 let mut pv = PrincipleVariation :: new ( ) ;
You can’t perform that action at this time.
0 commit comments