@@ -5,7 +5,7 @@ use rustc_lint::{LateContext, LateLintPass};
5
5
use rustc_middle:: ty;
6
6
use rustc_middle:: ty:: { ClauseKind , GenericPredicates , ProjectionPredicate , TraitPredicate } ;
7
7
use rustc_session:: declare_lint_pass;
8
- use rustc_span:: { BytePos , Span , sym} ;
8
+ use rustc_span:: { BytePos , Span , Symbol , sym} ;
9
9
10
10
declare_clippy_lint ! {
11
11
/// ### What it does
@@ -86,7 +86,7 @@ fn get_args_to_check<'tcx>(
86
86
fn_mut_trait : DefId ,
87
87
ord_trait : Option < DefId > ,
88
88
partial_ord_trait : Option < DefId > ,
89
- ) -> Vec < ( usize , String ) > {
89
+ ) -> Vec < ( usize , Symbol ) > {
90
90
let mut args_to_check = Vec :: new ( ) ;
91
91
if let Some ( def_id) = cx. typeck_results ( ) . type_dependent_def_id ( expr. hir_id ) {
92
92
let fn_sig = cx. tcx . fn_sig ( def_id) . instantiate_identity ( ) ;
@@ -116,15 +116,15 @@ fn get_args_to_check<'tcx>(
116
116
. iter ( )
117
117
. any ( |ord| Some ( ord. self_ty ( ) ) == return_ty_pred. term . as_type ( ) )
118
118
{
119
- args_to_check. push ( ( i, String :: from ( " Ord" ) ) ) ;
119
+ args_to_check. push ( ( i, sym :: Ord ) ) ;
120
120
if args_to_check. len ( ) == args_len - 1 {
121
121
break ;
122
122
}
123
123
} else if partial_ord_preds
124
124
. iter ( )
125
125
. any ( |pord| pord. self_ty ( ) == return_ty_pred. term . expect_type ( ) )
126
126
{
127
- args_to_check. push ( ( i, String :: from ( " PartialOrd" ) ) ) ;
127
+ args_to_check. push ( ( i, sym :: PartialOrd ) ) ;
128
128
if args_to_check. len ( ) == args_len - 1 {
129
129
break ;
130
130
}
@@ -188,7 +188,8 @@ impl<'tcx> LateLintPass<'tcx> for UnitReturnExpectingOrd {
188
188
span,
189
189
format ! (
190
190
"this closure returns \
191
- the unit type which also implements {trait_name}"
191
+ the unit type which also implements {}",
192
+ trait_name. as_str( )
192
193
) ,
193
194
) ;
194
195
} ,
@@ -199,7 +200,8 @@ impl<'tcx> LateLintPass<'tcx> for UnitReturnExpectingOrd {
199
200
span,
200
201
format ! (
201
202
"this closure returns \
202
- the unit type which also implements {trait_name}"
203
+ the unit type which also implements {}",
204
+ trait_name. as_str( )
203
205
) ,
204
206
Some ( last_semi) ,
205
207
"probably caused by this trailing semicolon" ,
0 commit comments