File tree 2 files changed +8
-7
lines changed
rustc_error_messages/locales/en-US
2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -283,3 +283,6 @@ lint-unused-delim = unnecessary {$delim} around {$item}
283
283
.suggestion = remove these { $delim }
284
284
285
285
lint-unused-import-braces = braces around { $node } is unnecessary
286
+
287
+ lint-unused-allocation = unnecessary allocation, use `&` instead
288
+ lint-unused-allocation-mut = unnecessary allocation, use `&mut` instead
Original file line number Diff line number Diff line change @@ -1169,15 +1169,13 @@ impl<'tcx> LateLintPass<'tcx> for UnusedAllocation {
1169
1169
for adj in cx. typeck_results ( ) . expr_adjustments ( e) {
1170
1170
if let adjustment:: Adjust :: Borrow ( adjustment:: AutoBorrow :: Ref ( _, m) ) = adj. kind {
1171
1171
cx. struct_span_lint ( UNUSED_ALLOCATION , e. span , |lint| {
1172
- let msg = match m {
1173
- adjustment:: AutoBorrowMutability :: Not => {
1174
- "unnecessary allocation, use `&` instead"
1175
- }
1172
+ lint. build ( match m {
1173
+ adjustment:: AutoBorrowMutability :: Not => fluent:: lint:: unused_allocation,
1176
1174
adjustment:: AutoBorrowMutability :: Mut { .. } => {
1177
- "unnecessary allocation, use `&mut` instead"
1175
+ fluent :: lint :: unused_allocation_mut
1178
1176
}
1179
- } ;
1180
- lint . build ( msg ) . emit ( ) ;
1177
+ } )
1178
+ . emit ( ) ;
1181
1179
} ) ;
1182
1180
}
1183
1181
}
You can’t perform that action at this time.
0 commit comments