File tree Expand file tree Collapse file tree 2 files changed +10
-14
lines changed Expand file tree Collapse file tree 2 files changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ fn check_version(config: &Config) -> Option<String> {
182182 }
183183
184184 msg. push_str ( "There have been changes to x.py since you last updated:\n " ) ;
185- msg. push_str ( & human_readable_changes ( & changes) ) ;
185+ msg. push_str ( & human_readable_changes ( changes) ) ;
186186
187187 msg. push_str ( "NOTE: to silence this warning, " ) ;
188188 msg. push_str ( & format ! (
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