File tree Expand file tree Collapse file tree 3 files changed +11
-15
lines changed Expand file tree Collapse file tree 3 files changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ fn check_version(config: &Config) -> Option<String> {
191191    } 
192192
193193    msg. push_str ( "There have been changes to x.py since you last updated:\n " ) ; 
194-     msg. push_str ( & human_readable_changes ( & changes) ) ; 
194+     msg. push_str ( & human_readable_changes ( changes) ) ; 
195195
196196    msg. push_str ( "NOTE: to silence this warning, " ) ; 
197197    msg. push_str ( & format ! ( 
Original file line number Diff line number Diff line change @@ -1381,7 +1381,7 @@ impl Config {
13811381                    if  !changes. is_empty ( )  { 
13821382                        println ! ( 
13831383                            "WARNING: There have been changes to x.py since you last updated:\n {}" , 
1384-                             crate :: human_readable_changes( & changes) 
1384+                             crate :: human_readable_changes( changes) 
13851385                        ) ; 
13861386                    } 
13871387                } 
Original file line number Diff line number Diff line change @@ -35,29 +35,25 @@ impl Display for ChangeSeverity {
3535    } 
3636} 
3737
38- pub  fn  find_recent_config_change_ids ( current_id :  usize )  -> Vec < ChangeInfo >  { 
39-     if  !CONFIG_CHANGE_HISTORY . iter ( ) . any ( |config| config. change_id  == current_id)  { 
38+ pub  fn  find_recent_config_change_ids ( current_id :  usize )  -> & ' static  [ ChangeInfo ]  { 
39+     if  let  Some ( index)  =
40+         CONFIG_CHANGE_HISTORY . iter ( ) . position ( |config| config. change_id  == current_id) 
41+     { 
42+         // Skip the current_id and IDs before it 
43+         & CONFIG_CHANGE_HISTORY [ index + 1 ..] 
44+     }  else  { 
4045        // If the current change-id is greater than the most recent one, return 
4146        // an empty list (it may be due to switching from a recent branch to an 
4247        // older one); otherwise, return the full list (assuming the user provided 
4348        // the incorrect change-id by accident). 
4449        if  let  Some ( config)  = CONFIG_CHANGE_HISTORY . iter ( ) . max_by_key ( |config| config. change_id )  { 
4550            if  current_id > config. change_id  { 
46-                 return  Vec :: new ( ) ; 
51+                 return  & [ ] ; 
4752            } 
4853        } 
4954
50-         return   CONFIG_CHANGE_HISTORY . to_vec ( ) ; 
55+         CONFIG_CHANGE_HISTORY 
5156    } 
52- 
53-     let  index =
54-         CONFIG_CHANGE_HISTORY . iter ( ) . position ( |config| config. change_id  == current_id) . unwrap ( ) ; 
55- 
56-     CONFIG_CHANGE_HISTORY 
57-         . iter ( ) 
58-         . skip ( index + 1 )  // Skip the current_id and IDs before it 
59-         . cloned ( ) 
60-         . collect ( ) 
6157} 
6258
6359pub  fn  human_readable_changes ( changes :  & [ ChangeInfo ] )  -> String  { 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments