Skip to content

Commit 94c2821

Browse files
committed
Also simplify macro_rules doctest code
1 parent ab0e727 commit 94c2821

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

compiler/rustc_lint/src/lints.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -1368,8 +1368,7 @@ pub enum NonLocalDefinitionsDiag {
13681368
depth: u32,
13691369
body_kind_descr: &'static str,
13701370
body_name: String,
1371-
help: Option<()>,
1372-
doctest_help: Option<()>,
1371+
doctest: bool,
13731372
cargo_update: Option<NonLocalDefinitionsCargoUpdateNote>,
13741373
},
13751374
}
@@ -1448,20 +1447,18 @@ impl<'a> LintDiagnostic<'a, ()> for NonLocalDefinitionsDiag {
14481447
depth,
14491448
body_kind_descr,
14501449
body_name,
1451-
help,
1452-
doctest_help,
1450+
doctest,
14531451
cargo_update,
14541452
} => {
14551453
diag.primary_message(fluent::lint_non_local_definitions_macro_rules);
14561454
diag.arg("depth", depth);
14571455
diag.arg("body_kind_descr", body_kind_descr);
14581456
diag.arg("body_name", body_name);
14591457

1460-
if let Some(()) = help {
1461-
diag.help(fluent::lint_help);
1462-
}
1463-
if let Some(()) = doctest_help {
1458+
if doctest {
14641459
diag.help(fluent::lint_help_doctest);
1460+
} else {
1461+
diag.help(fluent::lint_help);
14651462
}
14661463

14671464
diag.note(fluent::lint_non_local);

compiler/rustc_lint/src/non_local_def.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,7 @@ impl<'tcx> LateLintPass<'tcx> for NonLocalDefinitions {
304304
.map(|s| s.to_ident_string())
305305
.unwrap_or_else(|| "<unnameable>".to_string()),
306306
cargo_update: cargo_update(),
307-
help: (!is_at_toplevel_doctest()).then_some(()),
308-
doctest_help: is_at_toplevel_doctest().then_some(()),
307+
doctest: is_at_toplevel_doctest(),
309308
},
310309
)
311310
}

0 commit comments

Comments
 (0)