@@ -38,7 +38,7 @@ impl LateLintPass<'_> for RedundantBox {
3838 && let TyKind :: Path ( path) = hir_ty. kind
3939 && let Some ( boxed_ty) = qpath_generic_tys ( & path) . next ( )
4040 {
41- span_lint_and_sugg_ ( cx, hir_ty. span , boxed_ty. span ) ;
41+ emit_lint ( cx, hir_ty. span , boxed_ty. span ) ;
4242 }
4343 }
4444
@@ -48,22 +48,19 @@ impl LateLintPass<'_> for RedundantBox {
4848 && is_thin_type ( cx, boxed_ty)
4949 && let ExprKind :: Call ( _, & [ Expr { span, .. } ] ) = expr. kind
5050 {
51- span_lint_and_sugg_ ( cx, expr. span , span) ;
51+ emit_lint ( cx, expr. span , span) ;
5252 }
5353 }
5454}
5555
5656fn is_thin_type < ' tcx > ( cx : & LateContext < ' tcx > , ty : rustc_middle:: ty:: Ty < ' tcx > ) -> bool {
57- //TODO: usize's width will be the host's so lints may be misleading when the intended
58- // target is a different architecture. Can/should we do someting about it? Maybe make it
59- // configurable?
6057 ty. is_sized ( cx. tcx , cx. typing_env ( ) ) && {
6158 let size = 8 * approx_ty_size ( cx, ty) ;
6259 0 < size && size <= cx. sess ( ) . target . pointer_width as u64
6360 }
6461}
6562
66- fn span_lint_and_sugg_ ( cx : & LateContext < ' _ > , from_span : rustc_span:: Span , to_span : rustc_span:: Span ) {
63+ fn emit_lint ( cx : & LateContext < ' _ > , from_span : rustc_span:: Span , to_span : rustc_span:: Span ) {
6764 span_lint_and_sugg (
6865 cx,
6966 REDUNDANT_BOX ,
0 commit comments