@@ -294,7 +294,7 @@ impl CodegenOptions {
294
294
// JUSTIFICATION: defn of the suggested wrapper fn
295
295
#[ allow( rustc:: bad_opt_access) ]
296
296
pub fn instrument_coverage ( & self ) -> InstrumentCoverage {
297
- self . instrument_coverage . unwrap_or ( InstrumentCoverage :: Off )
297
+ self . instrument_coverage
298
298
}
299
299
}
300
300
@@ -913,23 +913,23 @@ mod parse {
913
913
}
914
914
915
915
pub ( crate ) fn parse_instrument_coverage (
916
- slot : & mut Option < InstrumentCoverage > ,
916
+ slot : & mut InstrumentCoverage ,
917
917
v : Option < & str > ,
918
918
) -> bool {
919
919
if v. is_some ( ) {
920
- let mut bool_arg = None ;
921
- if parse_opt_bool ( & mut bool_arg, v) {
922
- * slot = bool_arg. unwrap ( ) . then_some ( InstrumentCoverage :: All ) ;
920
+ let mut bool_arg = false ;
921
+ if parse_bool ( & mut bool_arg, v) {
922
+ * slot = if bool_arg { InstrumentCoverage :: All } else { InstrumentCoverage :: Off } ;
923
923
return true ;
924
924
}
925
925
}
926
926
927
927
let Some ( v) = v else {
928
- * slot = Some ( InstrumentCoverage :: All ) ;
928
+ * slot = InstrumentCoverage :: All ;
929
929
return true ;
930
930
} ;
931
931
932
- * slot = Some ( match v {
932
+ * slot = match v {
933
933
"all" => InstrumentCoverage :: All ,
934
934
"branch" => InstrumentCoverage :: Branch ,
935
935
"except-unused-generics" | "except_unused_generics" => {
@@ -940,7 +940,7 @@ mod parse {
940
940
}
941
941
"off" | "no" | "n" | "false" | "0" => InstrumentCoverage :: Off ,
942
942
_ => return false ,
943
- } ) ;
943
+ } ;
944
944
true
945
945
}
946
946
@@ -1352,7 +1352,7 @@ options! {
1352
1352
inline_threshold: Option <u32 > = ( None , parse_opt_number, [ TRACKED ] ,
1353
1353
"set the threshold for inlining a function" ) ,
1354
1354
#[ rustc_lint_opt_deny_field_access( "use `Session::instrument_coverage` instead of this field" ) ]
1355
- instrument_coverage: Option < InstrumentCoverage > = ( None , parse_instrument_coverage, [ TRACKED ] ,
1355
+ instrument_coverage: InstrumentCoverage = ( InstrumentCoverage :: Off , parse_instrument_coverage, [ TRACKED ] ,
1356
1356
"instrument the generated code to support LLVM source-based code coverage \
1357
1357
reports (note, the compiler build config must include `profiler = true`); \
1358
1358
implies `-C symbol-mangling-version=v0`. Optional values are:
0 commit comments