Skip to content

Commit 6354d12

Browse files
committed
Auto merge of #9633 - royrustdev:fix_rc_buffer, r=llogiq
update Applicability of `rc_buffer` lint from `MachineApplicable` to `Unspecified` `Unspecified` This changes `rc_buffer` from MachineApplicable to Unspecified ``` changelog: change [`rc_buffer`] to Unspecified. ``` fixes #6241 --- changelog: change [`rc_buffer`] to Unspecified.
2 parents 2d58817 + 31006b4 commit 6354d12

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

clippy_lints/src/types/rc_buffer.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use rustc_span::symbol::sym;
99
use super::RC_BUFFER;
1010

1111
pub(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

Comments
 (0)