@@ -9,6 +9,7 @@ use rustc_span::symbol::sym;
99use super :: RC_BUFFER ;
1010
1111pub ( super ) fn check ( cx : & LateContext < ' _ > , hir_ty : & hir:: Ty < ' _ > , qpath : & QPath < ' _ > , def_id : DefId ) -> bool {
12+ let app = Applicability :: Unspecified ;
1213 if cx. tcx . is_diagnostic_item ( sym:: Rc , def_id) {
1314 if let Some ( alternate) = match_buffer_type ( cx, qpath) {
1415 span_lint_and_sugg (
@@ -18,7 +19,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_
1819 "usage of `Rc<T>` when T is a buffer type" ,
1920 "try" ,
2021 format ! ( "Rc<{alternate}>" ) ,
21- Applicability :: MachineApplicable ,
22+ app ,
2223 ) ;
2324 } else {
2425 let Some ( ty) = qpath_generic_tys ( qpath) . next ( ) else { return false } ;
@@ -31,7 +32,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_
3132 Some ( ty) => ty. span ,
3233 None => return false ,
3334 } ;
34- let mut applicability = Applicability :: MachineApplicable ;
35+ let mut applicability = app ;
3536 span_lint_and_sugg (
3637 cx,
3738 RC_BUFFER ,
@@ -42,7 +43,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_
4243 "Rc<[{}]>" ,
4344 snippet_with_applicability( cx, inner_span, ".." , & mut applicability)
4445 ) ,
45- Applicability :: MachineApplicable ,
46+ app ,
4647 ) ;
4748 return true ;
4849 }
@@ -55,7 +56,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_
5556 "usage of `Arc<T>` when T is a buffer type" ,
5657 "try" ,
5758 format ! ( "Arc<{alternate}>" ) ,
58- Applicability :: MachineApplicable ,
59+ app ,
5960 ) ;
6061 } else if let Some ( ty) = qpath_generic_tys ( qpath) . next ( ) {
6162 let Some ( id) = path_def_id ( cx, ty) else { return false } ;
@@ -67,7 +68,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_
6768 Some ( ty) => ty. span ,
6869 None => return false ,
6970 } ;
70- let mut applicability = Applicability :: MachineApplicable ;
71+ let mut applicability = app ;
7172 span_lint_and_sugg (
7273 cx,
7374 RC_BUFFER ,
@@ -78,7 +79,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_
7879 "Arc<[{}]>" ,
7980 snippet_with_applicability( cx, inner_span, ".." , & mut applicability)
8081 ) ,
81- Applicability :: MachineApplicable ,
82+ app ,
8283 ) ;
8384 return true ;
8485 }
0 commit comments