File tree 2 files changed +10
-14
lines changed
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> {
182
182
}
183
183
184
184
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) ) ;
186
186
187
187
msg. push_str ( "NOTE: to silence this warning, " ) ;
188
188
msg. push_str ( & format ! (
Original file line number Diff line number Diff line change @@ -35,29 +35,25 @@ impl Display for ChangeSeverity {
35
35
}
36
36
}
37
37
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 {
40
45
// If the current change-id is greater than the most recent one, return
41
46
// an empty list (it may be due to switching from a recent branch to an
42
47
// older one); otherwise, return the full list (assuming the user provided
43
48
// the incorrect change-id by accident).
44
49
if let Some ( config) = CONFIG_CHANGE_HISTORY . iter ( ) . max_by_key ( |config| config. change_id ) {
45
50
if current_id > config. change_id {
46
- return Vec :: new ( ) ;
51
+ return & [ ] ;
47
52
}
48
53
}
49
54
50
- return CONFIG_CHANGE_HISTORY . to_vec ( ) ;
55
+ CONFIG_CHANGE_HISTORY
51
56
}
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 ( )
61
57
}
62
58
63
59
pub fn human_readable_changes ( changes : & [ ChangeInfo ] ) -> String {
You can’t perform that action at this time.
0 commit comments