@@ -349,7 +349,7 @@ where
349349 self . write_data_in_node_at ( new, value) ;
350350 self . free = self . node_at ( new) . next ;
351351
352- if let Some ( head) = self . head . option ( ) {
352+ if let Some ( head) = self . head . to_non_max ( ) {
353353 // Check if we need to replace head
354354 if self
355355 . read_data_in_node_at ( head)
@@ -359,7 +359,7 @@ where
359359 // It's not head, search the list for the correct placement
360360 let mut current = head;
361361
362- while let Some ( next) = self . node_at ( current) . next . option ( ) {
362+ while let Some ( next) = self . node_at ( current) . next . to_non_max ( ) {
363363 if self
364364 . read_data_in_node_at ( next)
365365 . cmp ( self . read_data_in_node_at ( new) )
@@ -443,7 +443,7 @@ where
443443 /// ```
444444 pub fn peek ( & self ) -> Option < & T > {
445445 self . head
446- . option ( )
446+ . to_non_max ( )
447447 . map ( |head| self . read_data_in_node_at ( head) )
448448 }
449449
@@ -506,7 +506,7 @@ where
506506 /// ```
507507 #[ inline]
508508 pub fn is_full ( & self ) -> bool {
509- self . free . option ( ) . is_none ( )
509+ self . free . to_non_max ( ) . is_none ( )
510510 }
511511
512512 /// Checks if the linked list is empty.
@@ -524,7 +524,7 @@ where
524524 /// ```
525525 #[ inline]
526526 pub fn is_empty ( & self ) -> bool {
527- self . head . option ( ) . is_none ( )
527+ self . head . to_non_max ( ) . is_none ( )
528528 }
529529}
530530
@@ -585,7 +585,7 @@ where
585585 where
586586 F : FnMut ( & T ) -> bool ,
587587 {
588- let head = self . head . option ( ) ?;
588+ let head = self . head . to_non_max ( ) ?;
589589
590590 // Special-case, first element
591591 if f ( self . read_data_in_node_at ( head) ) {
@@ -600,7 +600,7 @@ where
600600
601601 let mut current = head;
602602
603- while let Some ( next) = self . node_at ( current) . next . option ( ) {
603+ while let Some ( next) = self . node_at ( current) . next . to_non_max ( ) {
604604 if f ( self . read_data_in_node_at ( next) ) {
605605 return Some ( FindMutView {
606606 is_head : false ,
@@ -638,7 +638,7 @@ where
638638 type Item = & ' a T ;
639639
640640 fn next ( & mut self ) -> Option < Self :: Item > {
641- let index = self . index . option ( ) ?;
641+ let index = self . index . to_non_max ( ) ?;
642642
643643 let node = self . list . node_at ( index) ;
644644 self . index = node. next ;
@@ -798,17 +798,17 @@ where
798798// {
799799// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
800800// f.debug_struct("FindMut")
801- // .field("prev_index", &self.prev_index.option ())
802- // .field("index", &self.index.option ())
801+ // .field("prev_index", &self.prev_index.to_non_max ())
802+ // .field("index", &self.index.to_non_max ())
803803// .field(
804804// "prev_value",
805805// &self
806806// .list
807- // .read_data_in_node_at(self.prev_index.option ().unwrap()),
807+ // .read_data_in_node_at(self.prev_index.to_non_max ().unwrap()),
808808// )
809809// .field(
810810// "value",
811- // &self.list.read_data_in_node_at(self.index.option ().unwrap()),
811+ // &self.list.read_data_in_node_at(self.index.to_non_max ().unwrap()),
812812// )
813813// .finish()
814814// }
@@ -834,7 +834,7 @@ where
834834 fn drop ( & mut self ) {
835835 let mut index = self . head ;
836836
837- while let Some ( i) = index. option ( ) {
837+ while let Some ( i) = index. to_non_max ( ) {
838838 let node = self . node_at_mut ( i) ;
839839 index = node. next ;
840840
0 commit comments