@@ -8,7 +8,7 @@ use rustc_lint::{EarlyContext, EarlyLintPass};
8
8
use rustc_middle:: lint:: in_external_macro;
9
9
use rustc_session:: { declare_tool_lint, impl_lint_pass} ;
10
10
use rustc_span:: source_map:: Span ;
11
- use rustc_span:: symbol:: { Ident , SymbolStr } ;
11
+ use rustc_span:: symbol:: { Ident , Symbol } ;
12
12
use std:: cmp:: Ordering ;
13
13
14
14
declare_clippy_lint ! {
@@ -75,7 +75,7 @@ pub struct NonExpressiveNames {
75
75
impl_lint_pass ! ( NonExpressiveNames => [ SIMILAR_NAMES , MANY_SINGLE_CHAR_NAMES , JUST_UNDERSCORES_AND_DIGITS ] ) ;
76
76
77
77
struct ExistingName {
78
- interned : SymbolStr ,
78
+ interned : Symbol ,
79
79
span : Span ,
80
80
len : usize ,
81
81
exemptions : & ' static [ & ' static str ] ,
@@ -218,18 +218,19 @@ impl<'a, 'tcx, 'b> SimilarNamesNameVisitor<'a, 'tcx, 'b> {
218
218
let mut split_at = None ;
219
219
match existing_name. len . cmp ( & count) {
220
220
Ordering :: Greater => {
221
- if existing_name. len - count != 1 || levenstein_not_1 ( & interned_name, & existing_name. interned ) {
221
+ if existing_name. len - count != 1 || levenstein_not_1 ( & interned_name, & existing_name. interned . as_str ( ) ) {
222
222
continue ;
223
223
}
224
224
} ,
225
225
Ordering :: Less => {
226
- if count - existing_name. len != 1 || levenstein_not_1 ( & existing_name. interned , & interned_name) {
226
+ if count - existing_name. len != 1 || levenstein_not_1 ( & existing_name. interned . as_str ( ) , & interned_name) {
227
227
continue ;
228
228
}
229
229
} ,
230
230
Ordering :: Equal => {
231
231
let mut interned_chars = interned_name. chars ( ) ;
232
- let mut existing_chars = existing_name. interned . chars ( ) ;
232
+ let interned_str = existing_name. interned . as_str ( ) ;
233
+ let mut existing_chars = interned_str. chars ( ) ;
233
234
let first_i = interned_chars. next ( ) . expect ( "we know we have at least one char" ) ;
234
235
let first_e = existing_chars. next ( ) . expect ( "we know we have at least one char" ) ;
235
236
let eq_or_numeric = |( a, b) : ( char , char ) | a == b || a. is_numeric ( ) && b. is_numeric ( ) ;
@@ -302,7 +303,7 @@ impl<'a, 'tcx, 'b> SimilarNamesNameVisitor<'a, 'tcx, 'b> {
302
303
}
303
304
self . 0 . names . push ( ExistingName {
304
305
exemptions : get_exemptions ( & interned_name) . unwrap_or ( & [ ] ) ,
305
- interned : interned_name ,
306
+ interned : ident . name ,
306
307
span : ident. span ,
307
308
len : count,
308
309
} ) ;
0 commit comments