We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
ref_option_ref
1 parent 967f172 commit 615b761Copy full SHA for 615b761
clippy_lints/src/ref_option_ref.rs
@@ -52,7 +52,8 @@ impl<'tcx> LateLintPass<'tcx> for RefOptionRef {
52
GenericArg::Type(inner_ty) => Some(inner_ty),
53
_ => None,
54
});
55
- if let TyKind::Rptr(_, _) = inner_ty.kind;
+ if let TyKind::Rptr(_, ref inner_mut_ty) = inner_ty.kind;
56
+ if inner_mut_ty.mutbl == Mutability::Not;
57
58
then {
59
span_lint_and_sugg(
tests/ui/ref_option_ref.rs
@@ -45,3 +45,8 @@ impl RefOptTrait for u32 {
45
fn main() {
46
let x: &Option<&u32> = &None;
47
}
48
+
49
+fn issue9682(arg: &Option<&mut String>) {
50
+ // Should not lint, as the inner ref is mutable making it non `Copy`
51
+ println!("{arg:?}");
+}
0 commit comments