File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 4242#[ cfg( not( feature = "std" ) ) ]
4343extern crate alloc;
4444
45- use core:: { error:: Error , fmt:: Display , hint :: unreachable_unchecked , mem} ;
45+ use core:: { error:: Error , fmt:: Display , mem} ;
4646
4747#[ cfg( feature = "std" ) ]
4848use std:: { borrow:: Cow , env, fmt:: Debug } ;
@@ -466,10 +466,12 @@ where
466466 /// ```
467467 pub fn value ( & mut self ) -> Option < String > {
468468 match self . state {
469- State :: LeftoverValue ( _) => match mem:: replace ( & mut self . state , State :: NotInteresting ) {
470- State :: LeftoverValue ( val) => Some ( val) ,
471- _ => unsafe { unreachable_unchecked ( ) } ,
472- } ,
469+ State :: LeftoverValue ( ref mut value) => {
470+ let value = mem:: take ( value) ;
471+ self . state = State :: NotInteresting ;
472+
473+ Some ( value)
474+ }
473475 _ => None ,
474476 }
475477 }
You can’t perform that action at this time.
0 commit comments