mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-06 04:08:40 +00:00
Auto merge of #9684 - kraktus:ref_option_ref, r=xFrednet
`ref_option_ref` do not lint when inner reference is mutable changelog: FP: [`ref_option_ref`]: No longer lints if the inner reference is mutable fix https://github.com/rust-lang/rust-clippy/issues/9682
This commit is contained in:
commit
b72e451310
@ -52,7 +52,8 @@ impl<'tcx> LateLintPass<'tcx> for RefOptionRef {
|
|||||||
GenericArg::Type(inner_ty) => Some(inner_ty),
|
GenericArg::Type(inner_ty) => Some(inner_ty),
|
||||||
_ => None,
|
_ => None,
|
||||||
});
|
});
|
||||||
if let TyKind::Rptr(_, _) = inner_ty.kind;
|
if let TyKind::Rptr(_, ref inner_mut_ty) = inner_ty.kind;
|
||||||
|
if inner_mut_ty.mutbl == Mutability::Not;
|
||||||
|
|
||||||
then {
|
then {
|
||||||
span_lint_and_sugg(
|
span_lint_and_sugg(
|
||||||
|
@ -45,3 +45,8 @@ impl RefOptTrait for u32 {
|
|||||||
fn main() {
|
fn main() {
|
||||||
let x: &Option<&u32> = &None;
|
let x: &Option<&u32> = &None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn issue9682(arg: &Option<&mut String>) {
|
||||||
|
// Should not lint, as the inner ref is mutable making it non `Copy`
|
||||||
|
println!("{arg:?}");
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user