@@ -47,29 +47,44 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssertionsOnConstants {
47
47
if let ExprKind :: Lit ( ref inner) = lit. node {
48
48
match inner. node {
49
49
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
+ ) ;
53
57
} ,
54
58
LitKind :: Bool ( false ) if !is_debug_assert => {
55
59
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
+ ) ;
59
66
} ,
60
67
_ => ( ) ,
61
68
}
62
69
} else if let Some ( bool_const) = constant( cx, cx. tables, lit) {
63
70
match bool_const. 0 {
64
71
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
+ ) ;
68
79
} ,
69
80
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
+ ) ;
73
88
} ,
74
89
_ => ( ) ,
75
90
}
0 commit comments