Skip to content

Commit c8409f4

Browse files
Fix some bugs in the script
* Deprecation warnings * Case-insensitive section matching * Point at intended referenced PR/issue (helps debug why we aren't correctly finding it)
1 parent 700ccc2 commit c8409f4

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

src/main.rs

+18-6
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,14 @@ fn main() {
4242
let version = args
4343
.next()
4444
.expect("A version number (xx.yy.zz) for the Rust release is required.");
45-
let today = Utc::now().date();
45+
let today = Utc::now().date_naive();
4646

4747
// A known rust release date. (1.42.0)
48-
let mut end = Utc.ymd(2020, 3, 12);
48+
let mut end = Utc
49+
.with_ymd_and_hms(2020, 3, 12, 0, 0, 0)
50+
.single()
51+
.unwrap()
52+
.date_naive();
4953
let six_weeks = Duration::weeks(6);
5054

5155
// Get the most recent rust release date.
@@ -126,17 +130,20 @@ fn main() {
126130
}
127131

128132
eprintln!(
129-
"Did not use {:?} from {} <{}>",
133+
"Did not use {:?} from {} <{}> (intended to provide relnotes for: {:?})",
130134
section,
131135
issue.raw["title"].as_str().unwrap(),
132-
issue.raw["url"].as_str().unwrap()
136+
issue.raw["url"].as_str().unwrap(),
137+
issues
138+
.iter()
139+
.find(|i| i["number"].as_u64().unwrap() == issue.for_number)
133140
);
134141
}
135142
}
136143

137144
let relnotes = ReleaseNotes {
138145
version,
139-
date: (end + six_weeks).naive_utc(),
146+
date: end + six_weeks,
140147

141148
language_relnotes,
142149
compiler_relnotes,
@@ -282,6 +289,7 @@ struct TrackingIssues {
282289

283290
#[derive(Debug)]
284291
struct TrackingIssue {
292+
for_number: u64,
285293
raw: json::Value,
286294
// Section name -> (used, lines)
287295
sections: HashMap<String, (bool, Vec<String>)>,
@@ -331,6 +339,7 @@ impl TrackingIssues {
331339
tracking_issues.insert(
332340
for_number,
333341
TrackingIssue {
342+
for_number,
334343
raw: o.clone(),
335344
sections,
336345
},
@@ -362,7 +371,10 @@ fn map_to_line_items<'a>(
362371
}
363372

364373
for (section, (used, lines)) in issue.sections.iter_mut() {
365-
if let Some(contents) = by_section.get_mut(section.as_str()) {
374+
if let Some((_, contents)) = by_section
375+
.iter_mut()
376+
.find(|(s, _)| s.eq_ignore_ascii_case(section))
377+
{
366378
*used = true;
367379
for line in lines.iter() {
368380
contents.push_str(line);

0 commit comments

Comments
 (0)