Skip to content

Commit 40218ba

Browse files
committed
Format code
1 parent 5b836e3 commit 40218ba

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

clippy_lints/src/assertions_on_constants.rs

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,29 +47,44 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssertionsOnConstants {
4747
if let ExprKind::Lit(ref inner) = lit.node {
4848
match inner.node {
4949
LitKind::Bool(true) => {
50-
span_help_and_lint(cx, ASSERTIONS_ON_CONSTANTS, e.span,
51-
"assert!(true) will be optimized out by the compiler",
52-
"remove it");
50+
span_help_and_lint(
51+
cx,
52+
ASSERTIONS_ON_CONSTANTS,
53+
e.span,
54+
"`assert!(true)` will be optimized out by the compiler",
55+
"remove it"
56+
);
5357
},
5458
LitKind::Bool(false) if !is_debug_assert => {
5559
span_help_and_lint(
56-
cx, ASSERTIONS_ON_CONSTANTS, e.span,
57-
"assert!(false) should probably be replaced",
58-
"use panic!() or unreachable!()");
60+
cx,
61+
ASSERTIONS_ON_CONSTANTS,
62+
e.span,
63+
"`assert!(false)` should probably be replaced",
64+
"use `panic!()` or `unreachable!()`"
65+
);
5966
},
6067
_ => (),
6168
}
6269
} else if let Some(bool_const) = constant(cx, cx.tables, lit) {
6370
match bool_const.0 {
6471
Constant::Bool(true) => {
65-
span_help_and_lint(cx, ASSERTIONS_ON_CONSTANTS, e.span,
66-
"assert!(const: true) will be optimized out by the compiler",
67-
"remove it");
72+
span_help_and_lint(
73+
cx,
74+
ASSERTIONS_ON_CONSTANTS,
75+
e.span,
76+
"`assert!(const: true)` will be optimized out by the compiler",
77+
"remove it"
78+
);
6879
},
6980
Constant::Bool(false) if !is_debug_assert => {
70-
span_help_and_lint(cx, ASSERTIONS_ON_CONSTANTS, e.span,
71-
"assert!(const: false) should probably be replaced",
72-
"use panic!() or unreachable!()");
81+
span_help_and_lint(
82+
cx,
83+
ASSERTIONS_ON_CONSTANTS,
84+
e.span,
85+
"`assert!(const: false)` should probably be replaced",
86+
"use `panic!()` or `unreachable!()`"
87+
);
7388
},
7489
_ => (),
7590
}

0 commit comments

Comments
 (0)