@@ -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 |
|
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 |
|
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 |
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 |
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 { |