@@ -21,22 +21,19 @@ const RELNOTES_LABELS: &[&str] = &[
21
21
#[ derive( Clone , Template ) ]
22
22
#[ template( path = "relnotes.md" , escape = "none" ) ]
23
23
struct ReleaseNotes {
24
- cargo_relnotes : String ,
25
- cargo_unsorted : String ,
26
- compat_relnotes : String ,
27
- compat_unsorted : String ,
28
- compiler_relnotes : String ,
29
- compiler_unsorted : String ,
24
+ version : String ,
30
25
date : NaiveDate ,
26
+
31
27
language_relnotes : String ,
32
- language_unsorted : String ,
28
+ compiler_relnotes : String ,
33
29
libraries_relnotes : String ,
34
- libraries_unsorted : String ,
35
- unsorted : String ,
36
- unsorted_relnotes : String ,
37
- version : String ,
30
+ stabilized_apis_relnotes : String ,
31
+ const_stabilized_apis_relnotes : String ,
32
+ cargo_relnotes : String ,
33
+ rustdoc_relnotes : String ,
34
+ compat_relnotes : String ,
38
35
internal_changes_relnotes : String ,
39
- internal_changes_unsorted : String ,
36
+ other_relnotes : String ,
40
37
}
41
38
42
39
fn main ( ) {
@@ -68,58 +65,42 @@ fn main() {
68
65
. any ( |o| SKIP_LABELS . contains ( & o[ "name" ] . as_str ( ) . unwrap ( ) ) )
69
66
} ) ;
70
67
71
- let ( relnotes, rest ) = in_release
68
+ let relnotes = in_release
72
69
. into_iter ( )
73
- . partition :: < Vec < _ > , _ > ( |o| has_tags ( o, RELNOTES_LABELS ) ) ;
70
+ . filter ( |o| has_tags ( o, RELNOTES_LABELS ) )
71
+ . collect :: < Vec < _ > > ( ) ;
74
72
75
- let (
76
- compat_relnotes,
77
- libraries_relnotes,
73
+ let Sections {
78
74
language_relnotes,
79
75
compiler_relnotes,
76
+ libraries_relnotes,
77
+ stabilized_apis_relnotes,
78
+ const_stabilized_apis_relnotes,
79
+ rustdoc_relnotes,
80
+ compat_relnotes,
80
81
internal_changes_relnotes,
81
- unsorted_relnotes,
82
- ) = to_sections ( relnotes, & mut tracking_rust) ;
83
-
84
- let (
85
- compat_unsorted,
86
- libraries_unsorted,
87
- language_unsorted,
88
- compiler_unsorted,
89
- internal_changes_unsorted,
90
- unsorted,
91
- ) = to_sections ( rest, & mut tracking_rust) ;
82
+ other_relnotes,
83
+ } = to_sections ( relnotes, & mut tracking_rust) ;
92
84
93
85
let cargo_issues = get_issues_by_milestone ( & version, "cargo" ) ;
94
86
95
- let ( cargo_relnotes, cargo_unsorted ) = {
96
- let ( relnotes, rest ) = cargo_issues
87
+ let cargo_relnotes = {
88
+ let relnotes = cargo_issues
97
89
. iter ( )
98
- . partition :: < Vec < _ > , _ > ( |o| has_tags ( o, RELNOTES_LABELS ) ) ;
90
+ . filter ( |o| has_tags ( o, RELNOTES_LABELS ) )
91
+ . collect :: < Vec < _ > > ( ) ;
99
92
100
- (
101
- relnotes
102
- . iter ( )
103
- . map ( |o| {
104
- format ! (
105
- "- [{title}]({url}/)" ,
106
- title = o[ "title" ] . as_str( ) . unwrap( ) ,
107
- url = o[ "url" ] . as_str( ) . unwrap( ) ,
108
- )
109
- } )
110
- . collect :: < Vec < _ > > ( )
111
- . join ( "\n " ) ,
112
- rest. iter ( )
113
- . map ( |o| {
114
- format ! (
115
- "- [{title}]({url}/)" ,
116
- title = o[ "title" ] . as_str( ) . unwrap( ) ,
117
- url = o[ "url" ] . as_str( ) . unwrap( ) ,
118
- )
119
- } )
120
- . collect :: < Vec < _ > > ( )
121
- . join ( "\n " ) ,
122
- )
93
+ relnotes
94
+ . iter ( )
95
+ . map ( |o| {
96
+ format ! (
97
+ "- [{title}]({url}/)" ,
98
+ title = o[ "title" ] . as_str( ) . unwrap( ) ,
99
+ url = o[ "url" ] . as_str( ) . unwrap( ) ,
100
+ )
101
+ } )
102
+ . collect :: < Vec < _ > > ( )
103
+ . join ( "\n " )
123
104
} ;
124
105
125
106
for issue in tracking_rust. issues . values ( ) {
@@ -156,20 +137,17 @@ fn main() {
156
137
let relnotes = ReleaseNotes {
157
138
version,
158
139
date : ( end + six_weeks) . naive_utc ( ) ,
159
- compat_relnotes,
160
- compat_unsorted,
140
+
161
141
language_relnotes,
162
- language_unsorted,
163
- libraries_relnotes,
164
- libraries_unsorted,
165
142
compiler_relnotes,
166
- compiler_unsorted,
143
+ libraries_relnotes,
144
+ rustdoc_relnotes,
145
+ stabilized_apis_relnotes,
146
+ const_stabilized_apis_relnotes,
167
147
cargo_relnotes,
168
- cargo_unsorted,
169
148
internal_changes_relnotes,
170
- internal_changes_unsorted,
171
- unsorted_relnotes,
172
- unsorted,
149
+ compat_relnotes,
150
+ other_relnotes,
173
151
} ;
174
152
175
153
println ! ( "{}" , relnotes. render( ) . unwrap( ) ) ;
@@ -428,24 +406,44 @@ fn has_tags<'a>(o: &'a json::Value, tags: &[&str]) -> bool {
428
406
. any ( |o| tags. iter ( ) . any ( |tag| o[ "name" ] == * tag) )
429
407
}
430
408
409
+ struct Sections {
410
+ language_relnotes : String ,
411
+ compiler_relnotes : String ,
412
+ libraries_relnotes : String ,
413
+ stabilized_apis_relnotes : String ,
414
+ const_stabilized_apis_relnotes : String ,
415
+ rustdoc_relnotes : String ,
416
+ compat_relnotes : String ,
417
+ internal_changes_relnotes : String ,
418
+ other_relnotes : String ,
419
+ }
420
+
431
421
fn to_sections < ' a > (
432
422
iter : impl IntoIterator < Item = & ' a json:: Value > ,
433
423
mut tracking : & mut TrackingIssues ,
434
- ) -> ( String , String , String , String , String , String ) {
424
+ ) -> Sections {
435
425
let mut by_section = HashMap :: new ( ) ;
436
- by_section. insert ( "Compatibility Notes" , String :: new ( ) ) ;
437
- by_section. insert ( "Library" , String :: new ( ) ) ;
438
426
by_section. insert ( "Language" , String :: new ( ) ) ;
439
427
by_section. insert ( "Compiler" , String :: new ( ) ) ;
428
+ by_section. insert ( "Libraries" , String :: new ( ) ) ;
429
+ by_section. insert ( "Stabilized APIs" , String :: new ( ) ) ;
430
+ by_section. insert ( "Const Stabilized APIs" , String :: new ( ) ) ;
431
+ by_section. insert ( "Rustdoc" , String :: new ( ) ) ;
432
+ by_section. insert ( "Compatibility Notes" , String :: new ( ) ) ;
440
433
by_section. insert ( "Internal Changes" , String :: new ( ) ) ;
441
434
by_section. insert ( "Other" , String :: new ( ) ) ;
435
+
442
436
map_to_line_items ( iter, & mut tracking, & mut by_section) ;
443
- (
444
- by_section. remove ( "Compatibility Notes" ) . unwrap ( ) ,
445
- by_section. remove ( "Library" ) . unwrap ( ) ,
446
- by_section. remove ( "Language" ) . unwrap ( ) ,
447
- by_section. remove ( "Compiler" ) . unwrap ( ) ,
448
- by_section. remove ( "Internal Changes" ) . unwrap ( ) ,
449
- by_section. remove ( "Other" ) . unwrap ( ) ,
450
- )
437
+
438
+ Sections {
439
+ language_relnotes : by_section. remove ( "Language" ) . unwrap ( ) ,
440
+ compiler_relnotes : by_section. remove ( "Compiler" ) . unwrap ( ) ,
441
+ libraries_relnotes : by_section. remove ( "Libraries" ) . unwrap ( ) ,
442
+ stabilized_apis_relnotes : by_section. remove ( "Stabilized APIs" ) . unwrap ( ) ,
443
+ const_stabilized_apis_relnotes : by_section. remove ( "Const Stabilized APIs" ) . unwrap ( ) ,
444
+ rustdoc_relnotes : by_section. remove ( "Rustdoc" ) . unwrap ( ) ,
445
+ compat_relnotes : by_section. remove ( "Compatibility Notes" ) . unwrap ( ) ,
446
+ internal_changes_relnotes : by_section. remove ( "Internal Changes" ) . unwrap ( ) ,
447
+ other_relnotes : by_section. remove ( "Other" ) . unwrap ( ) ,
448
+ }
451
449
}
0 commit comments