@@ -39,23 +39,23 @@ declare_clippy_lint! {
39
39
/// }
40
40
/// ```
41
41
#[ clippy:: version = "1.77.0" ]
42
- pub THREAD_LOCAL_INITIALIZER_CAN_BE_MADE_CONST ,
42
+ pub MISSING_CONST_FOR_THREAD_LOCAL ,
43
43
perf,
44
44
"suggest using `const` in `thread_local!` macro"
45
45
}
46
46
47
- pub struct ThreadLocalInitializerCanBeMadeConst {
47
+ pub struct MissingConstForThreadLocal {
48
48
msrv : Msrv ,
49
49
}
50
50
51
- impl ThreadLocalInitializerCanBeMadeConst {
51
+ impl MissingConstForThreadLocal {
52
52
#[ must_use]
53
53
pub fn new ( msrv : Msrv ) -> Self {
54
54
Self { msrv }
55
55
}
56
56
}
57
57
58
- impl_lint_pass ! ( ThreadLocalInitializerCanBeMadeConst => [ THREAD_LOCAL_INITIALIZER_CAN_BE_MADE_CONST ] ) ;
58
+ impl_lint_pass ! ( MissingConstForThreadLocal => [ MISSING_CONST_FOR_THREAD_LOCAL ] ) ;
59
59
60
60
#[ inline]
61
61
fn is_thread_local_initializer (
@@ -102,7 +102,7 @@ fn initializer_can_be_made_const(cx: &LateContext<'_>, defid: rustc_span::def_id
102
102
false
103
103
}
104
104
105
- impl < ' tcx > LateLintPass < ' tcx > for ThreadLocalInitializerCanBeMadeConst {
105
+ impl < ' tcx > LateLintPass < ' tcx > for MissingConstForThreadLocal {
106
106
fn check_fn (
107
107
& mut self ,
108
108
cx : & LateContext < ' tcx > ,
@@ -113,7 +113,7 @@ impl<'tcx> LateLintPass<'tcx> for ThreadLocalInitializerCanBeMadeConst {
113
113
local_defid : rustc_span:: def_id:: LocalDefId ,
114
114
) {
115
115
let defid = local_defid. to_def_id ( ) ;
116
- if self . msrv . meets ( msrvs:: THREAD_LOCAL_INITIALIZER_CAN_BE_MADE_CONST )
116
+ if self . msrv . meets ( msrvs:: THREAD_LOCAL_CONST_INIT )
117
117
&& is_thread_local_initializer ( cx, fn_kind, span) . unwrap_or ( false )
118
118
// Some implementations of `thread_local!` include an initializer fn.
119
119
// In the case of a const initializer, the init fn is also const,
@@ -139,7 +139,7 @@ impl<'tcx> LateLintPass<'tcx> for ThreadLocalInitializerCanBeMadeConst {
139
139
{
140
140
span_lint_and_sugg (
141
141
cx,
142
- THREAD_LOCAL_INITIALIZER_CAN_BE_MADE_CONST ,
142
+ MISSING_CONST_FOR_THREAD_LOCAL ,
143
143
unpeeled. span ,
144
144
"initializer for `thread_local` value can be made `const`" ,
145
145
"replace with" ,
0 commit comments