@@ -1251,11 +1251,18 @@ pub fn parse_color(matches: &getopts::Matches) -> ColorConfig {
1251
1251
}
1252
1252
}
1253
1253
1254
+ /// Possible json config files
1255
+ pub struct JsonConfig {
1256
+ pub json_rendered : HumanReadableErrorType ,
1257
+ pub json_artifact_notifications : bool ,
1258
+ pub json_unused_externs : bool ,
1259
+ }
1260
+
1254
1261
/// Parse the `--json` flag.
1255
1262
///
1256
1263
/// The first value returned is how to render JSON diagnostics, and the second
1257
1264
/// is whether or not artifact notifications are enabled.
1258
- pub fn parse_json ( matches : & getopts:: Matches ) -> ( HumanReadableErrorType , bool , bool ) {
1265
+ pub fn parse_json ( matches : & getopts:: Matches ) -> JsonConfig {
1259
1266
let mut json_rendered: fn ( ColorConfig ) -> HumanReadableErrorType =
1260
1267
HumanReadableErrorType :: Default ;
1261
1268
let mut json_color = ColorConfig :: Never ;
@@ -1285,7 +1292,12 @@ pub fn parse_json(matches: &getopts::Matches) -> (HumanReadableErrorType, bool,
1285
1292
}
1286
1293
}
1287
1294
}
1288
- ( json_rendered ( json_color) , json_artifact_notifications, json_unused_externs)
1295
+
1296
+ JsonConfig {
1297
+ json_rendered : json_rendered ( json_color) ,
1298
+ json_artifact_notifications,
1299
+ json_unused_externs,
1300
+ }
1289
1301
}
1290
1302
1291
1303
/// Parses the `--error-format` flag.
@@ -1863,7 +1875,8 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
1863
1875
1864
1876
let edition = parse_crate_edition ( matches) ;
1865
1877
1866
- let ( json_rendered, json_artifact_notifications, json_unused_externs) = parse_json ( matches) ;
1878
+ let JsonConfig { json_rendered, json_artifact_notifications, json_unused_externs } =
1879
+ parse_json ( matches) ;
1867
1880
1868
1881
let error_format = parse_error_format ( matches, color, json_rendered) ;
1869
1882
0 commit comments