@@ -9,6 +9,7 @@ use rustc_span::symbol::sym;
9
9
use super :: RC_BUFFER ;
10
10
11
11
pub ( super ) fn check ( cx : & LateContext < ' _ > , hir_ty : & hir:: Ty < ' _ > , qpath : & QPath < ' _ > , def_id : DefId ) -> bool {
12
+ let app = Applicability :: Unspecified ;
12
13
if cx. tcx . is_diagnostic_item ( sym:: Rc , def_id) {
13
14
if let Some ( alternate) = match_buffer_type ( cx, qpath) {
14
15
span_lint_and_sugg (
@@ -18,7 +19,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_
18
19
"usage of `Rc<T>` when T is a buffer type" ,
19
20
"try" ,
20
21
format ! ( "Rc<{alternate}>" ) ,
21
- Applicability :: MachineApplicable ,
22
+ app ,
22
23
) ;
23
24
} else {
24
25
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<'_
31
32
Some ( ty) => ty. span ,
32
33
None => return false ,
33
34
} ;
34
- let mut applicability = Applicability :: MachineApplicable ;
35
+ let mut applicability = app ;
35
36
span_lint_and_sugg (
36
37
cx,
37
38
RC_BUFFER ,
@@ -42,7 +43,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_
42
43
"Rc<[{}]>" ,
43
44
snippet_with_applicability( cx, inner_span, ".." , & mut applicability)
44
45
) ,
45
- Applicability :: MachineApplicable ,
46
+ app ,
46
47
) ;
47
48
return true ;
48
49
}
@@ -55,7 +56,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_
55
56
"usage of `Arc<T>` when T is a buffer type" ,
56
57
"try" ,
57
58
format ! ( "Arc<{alternate}>" ) ,
58
- Applicability :: MachineApplicable ,
59
+ app ,
59
60
) ;
60
61
} else if let Some ( ty) = qpath_generic_tys ( qpath) . next ( ) {
61
62
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<'_
67
68
Some ( ty) => ty. span ,
68
69
None => return false ,
69
70
} ;
70
- let mut applicability = Applicability :: MachineApplicable ;
71
+ let mut applicability = app ;
71
72
span_lint_and_sugg (
72
73
cx,
73
74
RC_BUFFER ,
@@ -78,7 +79,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_
78
79
"Arc<[{}]>" ,
79
80
snippet_with_applicability( cx, inner_span, ".." , & mut applicability)
80
81
) ,
81
- Applicability :: MachineApplicable ,
82
+ app ,
82
83
) ;
83
84
return true ;
84
85
}
0 commit comments