mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-28 15:41:10 +00:00
Auto merge of #8552 - Jarcho:ptr_arg_8495, r=xFrednet
Don't lint `ptr_arg` on `&mut Cow<_>` fixes: #8495 changelog: Don't lint `ptr_arg` on `&mut Cow<_>`
This commit is contained in:
commit
8d5c0eadde
2 changed files with 8 additions and 1 deletions
|
@ -436,7 +436,7 @@ fn check_fn_args<'cx, 'tcx: 'cx>(
|
|||
DerefTy::Path,
|
||||
None,
|
||||
),
|
||||
Some(sym::Cow) => {
|
||||
Some(sym::Cow) if mutability == Mutability::Not => {
|
||||
let ty_name = name.args
|
||||
.and_then(|args| {
|
||||
args.args.iter().find_map(|a| match a {
|
||||
|
|
|
@ -194,3 +194,10 @@ fn two_vecs(a: &mut Vec<u32>, b: &mut Vec<u32>) {
|
|||
a.push(0);
|
||||
b.push(1);
|
||||
}
|
||||
|
||||
// Issue #8495
|
||||
fn cow_conditional_to_mut(a: &mut Cow<str>) {
|
||||
if a.is_empty() {
|
||||
a.to_mut().push_str("foo");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue