-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add owned_cow
lint
#13948
base: master
Are you sure you want to change the base?
add owned_cow
lint
#13948
Conversation
e442270
to
3f8fe08
Compare
clippy_lints/src/too_owned.rs
Outdated
/// | ||
/// ### Example | ||
/// ```no_run | ||
/// let wrogn: std::borrow::Cow<'_, String>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
___________________
< looks like a typo >
-------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a deliberate misspelling. Spelling "wrong" wrongly is a humourous way of normalizing making errors, learning from them and fixing them.
The hits on |
@samueltardieu for me, it suggests replacing the |
Indeed, I misread it, sorry for the false alarm! |
clippy_lints/src/too_owned.rs
Outdated
&& let Some(args) = last_seg.args | ||
&& let [_lt, carg] = args.args | ||
&& let hir::GenericArg::Type(cty) = carg | ||
&& let Some((span, repl)) = replacement(cx, cty) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth adding a span checks like !is_external_macro(...)
to avoid cases where the user can't do anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The types
checks already appear to do that.
clippy_lints/src/too_owned.rs
Outdated
/// let right: std::borrow::Cow<'_, str>; | ||
/// ``` | ||
#[clippy::version = "1.85.0"] | ||
pub OWNED_COW, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just here to say that I love the lint name 🐄
Closes #13697
changelog: add [
owned_cow
] lint