ptr_arg false positive when Cow's lifetime appears in return type #9218
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Summary
Clippy's warn-by-default
ptr_arg
lint is displeased about function arguments with the type&Cow<T>
. That's fine, but&Cow<'lifetime, T>
should be exempt from this lint when the Cow's lifetime is not elided.I hit this false positive in serde_yaml code that deals with deserializing borrowed &str. Since YAML deserializers can be constructed from either a
&'de str
as input (from_str
) orstd::io::Read
as input (from_reader
), and only the former supports deserializing output values that borrow from the input data, some stuff is represented using aCow
internally which isBorrowed
if deserializing from str andOwned
if deserializing from reader.Lint Name
ptr_arg
Reproducer
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: