@@ -349,7 +349,7 @@ where
349
349
self . write_data_in_node_at ( new, value) ;
350
350
self . free = self . node_at ( new) . next ;
351
351
352
- if let Some ( head) = self . head . option ( ) {
352
+ if let Some ( head) = self . head . to_non_max ( ) {
353
353
// Check if we need to replace head
354
354
if self
355
355
. read_data_in_node_at ( head)
@@ -359,7 +359,7 @@ where
359
359
// It's not head, search the list for the correct placement
360
360
let mut current = head;
361
361
362
- while let Some ( next) = self . node_at ( current) . next . option ( ) {
362
+ while let Some ( next) = self . node_at ( current) . next . to_non_max ( ) {
363
363
if self
364
364
. read_data_in_node_at ( next)
365
365
. cmp ( self . read_data_in_node_at ( new) )
@@ -443,7 +443,7 @@ where
443
443
/// ```
444
444
pub fn peek ( & self ) -> Option < & T > {
445
445
self . head
446
- . option ( )
446
+ . to_non_max ( )
447
447
. map ( |head| self . read_data_in_node_at ( head) )
448
448
}
449
449
@@ -506,7 +506,7 @@ where
506
506
/// ```
507
507
#[ inline]
508
508
pub fn is_full ( & self ) -> bool {
509
- self . free . option ( ) . is_none ( )
509
+ self . free . to_non_max ( ) . is_none ( )
510
510
}
511
511
512
512
/// Checks if the linked list is empty.
@@ -524,7 +524,7 @@ where
524
524
/// ```
525
525
#[ inline]
526
526
pub fn is_empty ( & self ) -> bool {
527
- self . head . option ( ) . is_none ( )
527
+ self . head . to_non_max ( ) . is_none ( )
528
528
}
529
529
}
530
530
@@ -585,7 +585,7 @@ where
585
585
where
586
586
F : FnMut ( & T ) -> bool ,
587
587
{
588
- let head = self . head . option ( ) ?;
588
+ let head = self . head . to_non_max ( ) ?;
589
589
590
590
// Special-case, first element
591
591
if f ( self . read_data_in_node_at ( head) ) {
@@ -600,7 +600,7 @@ where
600
600
601
601
let mut current = head;
602
602
603
- while let Some ( next) = self . node_at ( current) . next . option ( ) {
603
+ while let Some ( next) = self . node_at ( current) . next . to_non_max ( ) {
604
604
if f ( self . read_data_in_node_at ( next) ) {
605
605
return Some ( FindMutView {
606
606
is_head : false ,
@@ -638,7 +638,7 @@ where
638
638
type Item = & ' a T ;
639
639
640
640
fn next ( & mut self ) -> Option < Self :: Item > {
641
- let index = self . index . option ( ) ?;
641
+ let index = self . index . to_non_max ( ) ?;
642
642
643
643
let node = self . list . node_at ( index) ;
644
644
self . index = node. next ;
@@ -798,17 +798,17 @@ where
798
798
// {
799
799
// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
800
800
// 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 ())
803
803
// .field(
804
804
// "prev_value",
805
805
// &self
806
806
// .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()),
808
808
// )
809
809
// .field(
810
810
// "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()),
812
812
// )
813
813
// .finish()
814
814
// }
@@ -834,7 +834,7 @@ where
834
834
fn drop ( & mut self ) {
835
835
let mut index = self . head ;
836
836
837
- while let Some ( i) = index. option ( ) {
837
+ while let Some ( i) = index. to_non_max ( ) {
838
838
let node = self . node_at_mut ( i) ;
839
839
index = node. next ;
840
840
0 commit comments