@@ -294,7 +294,7 @@ impl CodegenOptions {
294294 // JUSTIFICATION: defn of the suggested wrapper fn
295295 #[ allow( rustc:: bad_opt_access) ]
296296 pub fn instrument_coverage ( & self ) -> InstrumentCoverage {
297- self . instrument_coverage . unwrap_or ( InstrumentCoverage :: Off )
297+ self . instrument_coverage
298298 }
299299}
300300
@@ -913,23 +913,23 @@ mod parse {
913913 }
914914
915915 pub ( crate ) fn parse_instrument_coverage (
916- slot : & mut Option < InstrumentCoverage > ,
916+ slot : & mut InstrumentCoverage ,
917917 v : Option < & str > ,
918918 ) -> bool {
919919 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 } ;
923923 return true ;
924924 }
925925 }
926926
927927 let Some ( v) = v else {
928- * slot = Some ( InstrumentCoverage :: All ) ;
928+ * slot = InstrumentCoverage :: All ;
929929 return true ;
930930 } ;
931931
932- * slot = Some ( match v {
932+ * slot = match v {
933933 "all" => InstrumentCoverage :: All ,
934934 "branch" => InstrumentCoverage :: Branch ,
935935 "except-unused-generics" | "except_unused_generics" => {
@@ -940,7 +940,7 @@ mod parse {
940940 }
941941 "off" | "no" | "n" | "false" | "0" => InstrumentCoverage :: Off ,
942942 _ => return false ,
943- } ) ;
943+ } ;
944944 true
945945 }
946946
@@ -1352,7 +1352,7 @@ options! {
13521352 inline_threshold: Option <u32 > = ( None , parse_opt_number, [ TRACKED ] ,
13531353 "set the threshold for inlining a function" ) ,
13541354 #[ 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 ] ,
13561356 "instrument the generated code to support LLVM source-based code coverage \
13571357 reports (note, the compiler build config must include `profiler = true`); \
13581358 implies `-C symbol-mangling-version=v0`. Optional values are:
0 commit comments