Skip to content

Commit

Permalink
Auto merge of #9633 - royrustdev:fix_rc_buffer, r=llogiq
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Oct 12, 2022
2 parents 2d58817 + 31006b4 commit 6354d12
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions clippy_lints/src/types/rc_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use rustc_span::symbol::sym;
use super::RC_BUFFER;

pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_>, def_id: DefId) -> bool {
let app = Applicability::Unspecified;
if cx.tcx.is_diagnostic_item(sym::Rc, def_id) {
if let Some(alternate) = match_buffer_type(cx, qpath) {
span_lint_and_sugg(
Expand All @@ -18,7 +19,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_
"usage of `Rc<T>` when T is a buffer type",
"try",
format!("Rc<{alternate}>"),
Applicability::MachineApplicable,
app,
);
} else {
let Some(ty) = qpath_generic_tys(qpath).next() else { return false };
Expand All @@ -31,7 +32,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_
Some(ty) => ty.span,
None => return false,
};
let mut applicability = Applicability::MachineApplicable;
let mut applicability = app;
span_lint_and_sugg(
cx,
RC_BUFFER,
Expand All @@ -42,7 +43,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_
"Rc<[{}]>",
snippet_with_applicability(cx, inner_span, "..", &mut applicability)
),
Applicability::MachineApplicable,
app,
);
return true;
}
Expand All @@ -55,7 +56,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_
"usage of `Arc<T>` when T is a buffer type",
"try",
format!("Arc<{alternate}>"),
Applicability::MachineApplicable,
app,
);
} else if let Some(ty) = qpath_generic_tys(qpath).next() {
let Some(id) = path_def_id(cx, ty) else { return false };
Expand All @@ -67,7 +68,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_
Some(ty) => ty.span,
None => return false,
};
let mut applicability = Applicability::MachineApplicable;
let mut applicability = app;
span_lint_and_sugg(
cx,
RC_BUFFER,
Expand All @@ -78,7 +79,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_
"Arc<[{}]>",
snippet_with_applicability(cx, inner_span, "..", &mut applicability)
),
Applicability::MachineApplicable,
app,
);
return true;
}
Expand Down

0 comments on commit 6354d12

Please sign in to comment.