Skip to content

cloned_ref_to_slice_refs doesn't trigger on implicit clone #16320

@xtqqczze

Description

@xtqqczze

Summary

The cloned_ref_to_slice_refs lint does not trigger for implicit clones such as to_owned().

Lint Name

cloned_ref_to_slice_refs

Reproducer

I tried this code:

let _a = String::new();
let _b = &[_a.to_owned()];

Expected behavior:
The cloned_ref_to_slice_refs lint should trigger.

Actual behavior:
The lint does not trigger.

godbolt.org

Version

nightly

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn't

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions